rany2/edge-tts
Python SDK and CLI for Microsoft Edge's online TTS, with MP3 and SRT output
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
edge-tts is a Python client for Microsoft Edge's online text-to-speech service, not a synthesis engine. The edge-tts CLI and Python Communicate interface submit text for remote synthesis. The library handles chunked requests and receives audio over WebSocket. Python callers can consume Communicate.stream() asynchronously or use save_sync() to write a file from synchronous code.
The package uses aiohttp 3.x for network I/O and declares certifi, tabulate, and typing-extensions as dependencies. In 7.4.0, code from edge_tts.util and edge_tts.data_classes moved into text, protocol, network, and config. Integrations that imported the removed modules need to update those imports. Voice selection changes the voice used by the remote service; it does not switch synthesis backends.
Key Capabilities & Differentiators
The CLI generates MP3 audio and SRT subtitles in one invocation with --write-media and --write-subtitles. Voice discovery is exposed through --list-voices, and --voice selects a locale-specific voice such as en-GB-SoniaNeural or ar-EG-SalmaNeural. --rate, --volume, and --pitch adjust delivery; pass negative values with an equals sign, such as --pitch=-5Hz, so they are parsed as values rather than flags.
edge-playback is a separate command for immediate listening rather than file export. It excludes the media and subtitle output flags and voice listing, and it requires mpv outside Windows. The SSML boundary is firm: the service accepts only the form generated by Edge, so the client does not support arbitrary caller-supplied markup.
Trade-offs & Limitations
Compared with an offline TTS engine, edge-tts eliminates model installation and local inference hardware, but submitted text leaves the host and synthesis stops when the online service is unreachable. The client also trades control for simplicity: its voice catalog and accepted markup are service constraints, not settings you can change by operating your own copy of the client.
Compared with a contracted speech API, keyless setup simplifies scripting but does not establish quotas, support, or an SLA. Upstream or network failures can still interrupt generation, even with retry handling. Treat licensing as two separate checks: pyproject.toml declares LGPL-3.0-only AND MIT for the package; that declaration does not establish permissions for Microsoft service usage or commercial use of generated audio.
Hardware & Deployment Guide
Install on Python 3.9 or later with pip install edge-tts or uv add edge-tts. For CLI-only use, uv tool install edge-tts installs the commands as a tool, while uvx edge-tts runs the command without a project installation. No Edge browser, API key, or local inference hardware is required. The environment still needs network access to the upstream service and must permit its WebSocket traffic.
Use at least 7.4.2 if your application passes a custom aiohttp connector: it fixes session teardown closing that connector between chunks or retries. Version 7.4.1 detects and retries premature WebSocket closes that previously could surface as a misleading NoAudioReceived error or return truncated audio. Version 7.4.0 raised the Python minimum to 3.9 and removed edge_tts.util and edge_tts.data_classes; check existing imports before upgrading.
Communicate supports synchronous file output and asynchronous streaming.--write-media and --write-subtitles produce MP3 audio and SRT subtitles in one CLI invocation.--list-voices, choose one with --voice, and adjust rate, volume, or pitch without custom SSML.Developer scripts, narration prototypes, and audio-plus-subtitle workflows that can send text to Microsoft's online service and use its voice catalog.
Text must stay on-premises, synthesis must run offline, or the workload requires custom SSML, backend control, or contractual guarantees for throughput and availability.
Quick Start & Installation
uv sync # create the environment from uv.lock uv run pre-commit install # lint, format and type-check on every commit uv run pytest
Comparison vs. Top Voice, Vision & Video Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| edge-tts ★ | 12.7k | +54 | Python | — | Python SDK and CLI for Microsoft Edge's online TTS, with MP3 and SRT output |
| Speech | 18.8k | +18 | Python | Apache-2.0 | PyTorch speech SDK for training, adapting, and running ASR, TTS, and SpeechLM mo |
| mlx-audio | 8.4k | +32 | Python | MIT | MLX inference SDK for local speech and audio pipelines on Apple Silicon |
| PaddleSpeech | 12.7k | — | Python | Apache-2.0 | PaddlePaddle-based SDK for local and streaming speech recognition and synthesis |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/rany2/edge-tts.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about edge-tts
How should I integrate edge-tts into a script or an async application?
edge_tts.Communicate(text, voice).save_sync(path) in a synchronous script. In an asyncio application that needs incremental audio, consume Communicate.stream() and handle failures during stream iteration. If you pass a custom aiohttp connector, use 7.4.2 or later for the fix that keeps it open across requests.Do I need a GPU, and what determines client-side resource use?
Can I use this commercially or self-host it for compliance?
LGPL-3.0-only AND MIT. Review obligations for the components you modify or distribute, and separately verify Microsoft's current service terms for your workload and use of the generated audio. You can host the Python client in your own environment, but that does not self-host the synthesis engine or keep submitted text on your infrastructure.When should I choose an offline engine or a contracted speech API instead?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy