explaingit

rany2/edge-tts

10,860PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

Python tool that converts any text to spoken MP3 audio using Microsoft Edge's free online voice service, no API key, no Windows, and no Edge browser required. Supports hundreds of voices across many languages.

Mindmap

mindmap
  root((edge-tts))
    What it does
      Text to MP3
      Subtitle timing file
      Real-time playback
    Voice options
      Hundreds of voices
      Many languages
      Speed pitch volume
    Usage
      Command line
      Python library
    Integrations
      Home Assistant
      Podcast tools
    Audience
      Developers
      Content creators
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Generate MP3 narration for a video or podcast from a text script without paying for a TTS API.

USE CASE 2

Add text-to-speech to a Python app or Home Assistant automation using the library interface.

USE CASE 3

Convert a long article to audio to listen while commuting, with word-level subtitle timing saved alongside it.

Tech stack

Python

Getting it running

Difficulty · easy Time to first run · 5min

Requires an internet connection to reach Microsoft Edge's TTS service. The playback companion (edge-playback) needs mpv installed on non-Windows systems.

In plain English

edge-tts is a Python library and command-line tool that converts text into spoken audio using Microsoft Edge's text-to-speech service. It does not require Microsoft Edge, Windows, or any API key. It works by connecting to the same online service that the Edge browser uses for its built-in read-aloud feature. From the command line you can pass in any text and get an MP3 audio file as output. The tool also generates a subtitle file alongside the audio so that the timing of each word is recorded. A companion command called edge-playback lets you hear the result immediately instead of saving it to a file, though that requires a separate media player called mpv (except on Windows). The service supports a large number of voices across many languages, including Arabic, Afrikaans, Amharic, and many more not shown in the excerpt. You can list all available voices with a single command and then specify which one to use. Each voice has a gender and personality description listed alongside it. Speech speed, volume, and pitch can all be adjusted through command-line options. For example, you can slow the speech to half speed, reduce the volume by 50 percent, or lower the pitch by 50Hz. The library can also be used directly in Python code for cases where you want to generate speech as part of a larger program. The README points to example files in the repository and lists a few other projects that use it, including a Home Assistant integration and a podcast generation tool. The project is installed via pip with a single command and has no unusual system requirements beyond Python and an internet connection.

Copy-paste prompts

Prompt 1
I want to turn a text file into an MP3 using edge-tts with a British English female voice. Give me the exact command.
Prompt 2
How do I list all available Spanish voices in edge-tts and pick one?
Prompt 3
Show me Python code that uses edge-tts to read a string aloud and save the output as an MP3 file.
Prompt 4
I need edge-tts to speak at half speed with a lower pitch. What command-line flags do I use?
Open on GitHub → Explain another repo

← rany2 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.