npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capacitor-edge-tts

v1.0.1

Published

Capacitor plugin for Microsoft Edge Text-to-Speech. Free, high-quality TTS using Microsoft Edge's speech synthesis API. Works on Android (native) and Web.

Downloads

182

Readme

capacitor-edge-tts

Free, high-quality Text-to-Speech for Capacitor apps using Microsoft Edge's speech synthesis API.

No API key required. No server needed. Works offline-ready on Android.

Features

  • Free: Uses Microsoft Edge's built-in TTS service (same as edge-tts Python library)
  • High Quality: Access to 400+ neural voices in 100+ languages
  • No API Key: Works without any Microsoft Azure subscription
  • Cross-Platform: Works on Android (native) and Web (WebSocket)
  • SSML Support: Control rate, pitch, and volume
  • Lightweight: Minimal dependencies (only OkHttp on Android)

Why This Plugin?

WebSocket connections to Microsoft's TTS service are blocked in Android WebView due to security restrictions. This plugin uses native OkHttp WebSocket on Android to bypass this limitation, while falling back to standard WebSocket on web platforms.

Install

npm install capacitor-edge-tts
npx cap sync

Usage

Basic Example

import { EdgeTTS } from 'capacitor-edge-tts';

// Simple text-to-speech
const result = await EdgeTTS.synthesize({
  text: 'Hello, world!',
  voice: 'en-US-AriaNeural'
});

// Decode and play audio
const audioData = Uint8Array.from(atob(result.audio), c => c.charCodeAt(0));
const audioContext = new AudioContext();
const audioBuffer = await audioContext.decodeAudioData(audioData.buffer);
const source = audioContext.createBufferSource();
source.buffer = audioBuffer;
source.connect(audioContext.destination);
source.start(0);

With Options

const result = await EdgeTTS.synthesize({
  text: 'Bonjour le monde!',
  voice: 'fr-FR-VivienneMultilingualNeural',
  rate: '+20%',    // Speed: -50% to +100%
  volume: '+0%',   // Volume: -50% to +50%
  pitch: '+0Hz'    // Pitch adjustment
});

Check Availability

const { available } = await EdgeTTS.isAvailable();
if (available) {
  // Edge TTS is ready
}

Get Available Voices

const { voices } = await EdgeTTS.getVoices();

// Filter by language
const frenchVoices = voices.filter(v => v.locale.startsWith('fr-'));
console.log(frenchVoices);
// [
//   { id: 'fr-FR-VivienneMultilingualNeural', name: 'Vivienne', locale: 'fr-FR', gender: 'Female', multilingual: true },
//   { id: 'fr-FR-RemyMultilingualNeural', name: 'Rémy', locale: 'fr-FR', gender: 'Male', multilingual: true },
//   ...
// ]

Popular Voices

| Voice ID | Name | Language | Gender | |----------|------|----------|--------| | en-US-AriaNeural | Aria | English (US) | Female | | en-US-GuyNeural | Guy | English (US) | Male | | en-GB-SoniaNeural | Sonia | English (UK) | Female | | fr-FR-VivienneMultilingualNeural | Vivienne | French | Female | | fr-FR-RemyMultilingualNeural | Rémy | French | Male | | de-DE-KatjaNeural | Katja | German | Female | | es-ES-ElviraNeural | Elvira | Spanish | Female | | it-IT-ElsaNeural | Elsa | Italian | Female | | ja-JP-NanamiNeural | Nanami | Japanese | Female | | zh-CN-XiaoxiaoNeural | Xiaoxiao | Chinese | Female | | ko-KR-SunHiNeural | SunHi | Korean | Female | | pt-BR-FranciscaNeural | Francisca | Portuguese (BR) | Female |

For the full list of 400+ voices, see Microsoft's documentation.

API

synthesize(...)

synthesize(options: SynthesizeOptions) => Promise<SynthesizeResult>

Synthesize text to speech and return audio data.

| Param | Type | Description | | ------------- | --------------------------------------------------------------- | ------------------------------------------------------ | | options | SynthesizeOptions | - Synthesis options including text and voice settings. |

Returns: Promise<SynthesizeResult>


isAvailable()

isAvailable() => Promise<IsAvailableResult>

Check if Edge TTS is available on this platform.

Returns: Promise<IsAvailableResult>


getVoices()

getVoices() => Promise<GetVoicesResult>

Get list of available voices.

Note: On Android, this returns a curated list of popular voices. The full list of 400+ voices is available at: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support

Returns: Promise<GetVoicesResult>


Interfaces

SynthesizeResult

| Prop | Type | Description | | ----------- | ------------------- | -------------------------------- | | audio | string | Base64-encoded MP3 audio data. | | size | number | Size of the audio data in bytes. |

SynthesizeOptions

| Prop | Type | Description | Default | | ------------ | ------------------- | --------------------------------------------------------------------- | ------------------------------- | | text | string | The text to synthesize into speech. | | | voice | string | The voice to use for synthesis. | 'en-US-AriaNeural' | | rate | string | Speech rate adjustment. Format: '+X%' or '-X%' where X is percentage. | '+0%' | | volume | string | Volume adjustment. Format: '+X%' or '-X%' where X is percentage. | '+0%' | | pitch | string | Pitch adjustment. Format: '+XHz' or '-XHz' where X is hertz. | '+0Hz' |

IsAvailableResult

| Prop | Type | Description | | --------------- | -------------------- | ----------------------------------------------- | | available | boolean | Whether Edge TTS is available on this platform. |

GetVoicesResult

| Prop | Type | Description | | ------------ | ------------------------ | ------------------------- | | voices | VoiceInfo[] | List of available voices. |

VoiceInfo

| Prop | Type | Description | | ------------------ | ------------------------------- | ---------------------------------------------- | | id | string | Voice identifier (e.g., 'en-US-AriaNeural'). | | name | string | Display name of the voice. | | locale | string | Locale/language code (e.g., 'en-US', 'fr-FR'). | | gender | 'Male' | 'Female' | Gender of the voice ('Male' or 'Female'). | | multilingual | boolean | Whether this is a multilingual voice. |

Platform Support

| Platform | Implementation | Notes | |----------|---------------|-------| | Android | Native (OkHttp WebSocket) | Full support, bypasses WebView restrictions | | Web | WebSocket | Full support | | iOS | Not yet supported | PRs welcome! |

How It Works

This plugin connects directly to Microsoft's Edge TTS WebSocket service (wss://speech.platform.bing.com). It uses the same protocol as the edge-tts Python library.

On Android, WebSocket connections from WebView are often blocked or unreliable. This plugin uses OkHttp's native WebSocket implementation to ensure reliable connections.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development

# Clone the repo
git clone https://github.com/anthropics/capacitor-edge-tts.git
cd capacitor-edge-tts

# Install dependencies
npm install

# Build
npm run build

# Test in a Capacitor app
npm link
cd /path/to/your/capacitor/app
npm link capacitor-edge-tts
npx cap sync

Credits

  • Inspired by edge-tts Python library
  • Uses Microsoft Edge's free TTS service