How rany2/edge-tts works
edge-tts is a Python client and command-line tool for Microsoft Edge’s online text-to-speech service, with voice discovery, audio streaming, and subtitle output; edge-playback adds immediate playback. The main workflow is CLI input and settings → synthesis request → streamed audio and timing metadata → audio/subtitle output, optionally followed by playback. Voice discovery is a separate capability. The graph also includes configuration, token generation, and subtitle composition as internal layers. Some modules are indexed but not excerpted; their connections are included only where the index or README supports them.
Main entry points: communicate.py Communicate stream · util.py TTS CLI · __main__.py Playback launcher · voices.py Voice discovery
Components 16
Speech synthesis
- Communicate stream
src/edge_tts/communicate.py - TTS configuration
src/edge_tts/data_classes.py - Service constants
src/edge_tts/constants.py - Request tokens
src/edge_tts/drm.py - TTS errors
src/edge_tts/exceptions.py
Voice discovery
- Voice discovery
src/edge_tts/voices.py
CLI output
- TTS CLI
src/edge_tts/util.py - Subtitle maker
src/edge_tts/submaker.py - SRT composer
src/edge_tts/srt_composer.py - Media and subtitle output
src/edge_tts/util.py
Audio playback
- Playback launcher
src/edge_playback/__main__.py - Windows playback
src/edge_playback/win32_playback.py
Other components
- User
- Microsoft TTS
- Voice listing API
- mpv player
Connections 17
- User → TTS CLI: provides input
README.md - TTS CLI → Communicate stream: configures stream
src/edge_tts/util.py - Communicate stream → TTS configuration: validates settings
src/edge_tts/communicate.py - Communicate stream → Service constants: uses protocol constants
src/edge_tts/communicate.py - Communicate stream → Request tokens: generates request tokens
src/edge_tts/communicate.py - Communicate stream → TTS errors: raises service errors
src/edge_tts/communicate.py - Communicate stream → Microsoft TTS: streams synthesis
src/edge_tts/communicate.py - TTS CLI → Subtitle maker: feeds boundaries
src/edge_tts/util.py - Subtitle maker → SRT composer: composes subtitles
src/edge_tts/submaker.py - TTS CLI → Media and subtitle output: writes media
src/edge_tts/util.py - TTS CLI → Voice discovery: lists voices
src/edge_tts/util.py - Voice discovery → Voice listing API: requests voice list
src/edge_tts/voices.py - Voice discovery → Request tokens: generates request tokens
src/edge_tts/voices.py - User → Playback launcher: starts playback
README.md - Playback launcher → TTS CLI: runs synthesis CLI
src/edge_playback/__main__.py - Playback launcher → mpv player: plays media
src/edge_playback/__main__.py - Playback launcher → Windows playback: uses Windows playback
src/edge_playback/__main__.py