# Repository Briefing: rany2/edge-tts
> Source: https://repoforai.com/repo/rany2/edge-tts (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/rany2/edge-tts
- **Official Docs / Website**: https://pypi.org/project/edge-tts/
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: A (82/100 · Maintenance 35/35 · Adoption 21/25 · Releases 20/20 · License 6/20)
- **Latest Release**: 7.4.2 (2026-11-30) — https://github.com/rany2/edge-tts/releases
- **Review Snapshot**: 2026-12-01
- **Deployment / Stack Signals**: CLI, API
- **Momentum**: 12,708 ★ total (+11 24h / +54 7d) · 1,215 forks
- **Topics**: `asyncio`, `cli`, `microsoft-edge`, `neural-tts`, `python`, `speech-synthesis`, `subtitles`, `text-to-speech`, `tts`
- **When to Use**: Best for: Developer scripts, narration prototypes, and audio-plus-subtitle workflows that can send text to Microsoft's online service and use its voice catalog. Skip if: Text must stay on-premises, synthesis must run offline, or the workload requires custom SSML, backend control, or contractual guarantees for throughput and availability.

## Overview
```text
### Architecture & 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.
```

## Key Capabilities
```text
- Execution: Python SDK and CLI submit text to Microsoft Edge's online synthesis service; no local model is loaded.
- Integration: `Communicate` supports synchronous file output and asynchronous streaming.
- Deliverables: `--write-media` and `--write-subtitles` produce MP3 audio and SRT subtitles in one CLI invocation.
- Voice controls: Discover voices with `--list-voices`, choose one with `--voice`, and adjust rate, volume, or pitch without custom SSML.
- Stream integrity: 7.4.1 detects and retries premature WebSocket closes that could previously return truncated audio.
- Connector lifecycle: 7.4.2 keeps caller-supplied aiohttp connectors open across chunks and retries.
```

## Quick Start / Clone
```bash
uv sync                            # create the environment from uv.lock
uv run pre-commit install          # lint, format and type-check on every commit
uv run pytest
```
