edge-tts is a Python library (current version 7.2.8) that provides access to Microsoft Edge's online text-to-speech (TTS) service. It allows developers to convert text into natural-sounding speech without needing the Edge browser, Windows, or an API key, by leveraging the same cloud voices used by Edge. The library maintains an active release cadence, frequently updating to address changes in the underlying Microsoft service.
pip install edge-ttsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to convert a text string into an MP3 audio file using a specified voice. It uses `asyncio` for asynchronous operations, which is fundamental to how `edge-tts` works. Replace 'en-US-JennyNeural' with your desired voice; you can list all available voices using the command-line tool `edge-tts --list-voices`.
Always keep the `edge-tts` library updated to the latest version to incorporate fixes for upstream API changes. Monitor the GitHub repository for immediate updates.
Avoid using complex or custom SSML tags. Only basic prosody adjustments (rate, volume, pitch) are reliably supported. For advanced speech customization, consider official Azure Cognitive Services TTS which offers full SSML support.
Ensure your code structure uses `async def` for functions interacting with `edge_tts` and invokes the main async function using `asyncio.run(your_async_function())`.
Verify the voice name is exact and currently available using `edge-tts --list-voices`. Check your internet connection. Implement error handling and retry logic, or try a different voice/locale if the issue persists.
Migrate any code relying on `merge_cues` or `words-in-cue` to use `SentenceBoundary` events for cue synchronization. The library now defaults to `SentenceBoundary` cues.
1. Verify that the voice name is correct and available using `edge-tts --list-voices`. 2. Ensure a stable internet connection. 3. Update the `edge-tts` library to the latest version (`pip install --upgrade edge-tts`), as updates often address API changes from Microsoft. 4. Double-check your system's date and time are correct.
Install the library using pip: `pip install edge-tts`. If using multiple Python environments, ensure it's installed in the correct one or use `python -m pip install edge-tts`.
Update the `edge-tts` library to the latest version (`pip install --upgrade edge-tts`), as the developers frequently release updates to adapt to changes in the Microsoft API.
Avoid using complex or deeply nested SSML structures. Restrict SSML usage to basic `<speak>` and `<prosody>` tags for adjustments like rate, volume, and pitch, as supported directly by the library's command-line options. Ensure no special characters like '<' are unescaped if directly embedding in text.