Home
Login

Python module to use Microsoft Edge's online text-to-speech service for free, without Edge browser, Windows system, or API key.

LGPL-3.0Python 8.4krany2 Last Updated: 2025-05-03

Edge-TTS Project Detailed Introduction

Project Overview

Edge-TTS is a powerful Python module that allows you to use Microsoft Edge's online text-to-speech service without installing the Microsoft Edge browser, Windows operating system, or API keys. This project provides developers with an easy-to-use interface to access Microsoft's high-quality speech synthesis service.

Project Address

Core Features

1. Zero-Configuration Usage

  • No Microsoft Edge browser required
  • No Windows operating system required
  • No API keys or account registration required
  • Completely free to use

2. Multiple Usage Methods

  • Command-line tools: edge-tts and edge-playback commands
  • Python module: Can be directly called in Python code
  • Batch processing: Supports batch text-to-speech conversion

3. Rich Voice Selection

  • Supports multiple languages and regions
  • Provides male and female voice options
  • Includes different voice personalities and styles

Installation Method

Standard Installation

pip install edge-tts

Installation using pipx (Recommended for command-line tools)

pipx install edge-tts

Basic Usage Method

Command-line Usage

Basic Text-to-Speech

edge-tts --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.srt

Real-time Playback (Requires mpv player)

edge-playback --text "Hello, world!"

List All Available Voices

edge-tts --list-voices

Use a Specific Voice

edge-tts --voice ar-EG-SalmaNeural --text "مرحبا كيف حالك؟" --write-media hello_in_arabic.mp3

Voice Parameter Adjustment

Adjust Speech Rate

edge-tts --rate=-50% --text "Hello, world!" --write-media hello_slow.mp3

Adjust Volume

edge-tts --volume=-50% --text "Hello, world!" --write-media hello_quiet.mp3

Adjust Pitch

edge-tts --pitch=-50Hz --text "Hello, world!" --write-media hello_low_pitch.mp3

Supported Languages and Regions

Edge-TTS supports numerous languages and regional variations, including but not limited to:

  • Arabic: Multiple regional variations (Egypt, UAE, Bahrain, etc.)
  • Chinese: Simplified Chinese, Traditional Chinese, etc.
  • English: American, British, Australian, and other accents
  • French: France, Canada, etc.
  • German: Germany, Austria, etc.
  • Japanese: Japan
  • Korean: Korea
  • Spanish: Spain, Mexico, Argentina, etc.
  • Other: Including Afrikaans, Amharic, and other minority languages

Python Programming Interface

Edge-TTS can be used directly in code as a Python module, suitable for integration into various applications.

Technical Features

1. Output Format

  • Audio Files: Supports MP3 format output
  • Subtitle Files: Supports SRT format subtitles for easy synchronized display

2. SSML Support Limitations

Due to Microsoft's security restrictions, custom SSML functionality has been removed. The service only allows the use of SSML formats that Microsoft Edge itself can generate, which means it only supports a single <voice> tag and a single <prosody> tag within it.

3. Parameter Control

  • Speech Rate Control: Adjusted via the --rate parameter
  • Volume Control: Adjusted via the --volume parameter
  • Pitch Control: Adjusted via the --pitch parameter

Application Scenarios

1. Content Creation

  • Podcast production
  • Video dubbing
  • Audiobook production

2. Accessibility Applications

  • Web page content reading
  • Document vocalization
  • Assistive tools for the visually impaired

3. Education and Training

  • Language learning materials
  • Online course narration
  • Pronunciation example generation

4. Automation Applications

  • Smart assistant voice feedback
  • Notification system voice broadcast
  • Batch content processing

Related Projects

Several open-source projects use the edge-tts module:

  • hass-edge-tts: Home Assistant TTS integration
  • Podcastfy: Podcast production tool
  • tts-samples: TTS voice sample collection project

Advantages Summary

  1. Completely Free: No fees required
  2. High-Quality Voice: Based on Microsoft's advanced speech synthesis technology
  3. Easy to Use: Very simple to install and use
  4. Cross-Platform: Supports Linux, macOS, Windows
  5. Multi-Language: Supports major global languages
  6. Open Source: Code is open source, freely modifiable and distributable
  7. Actively Maintained: Project is continuously updated and maintained

Precautions

  1. Network Dependency: Requires an internet connection to access Microsoft's online services
  2. Playback Dependency: The edge-playback command requires the installation of the mpv player on non-Windows systems
  3. Service Limitations: Subject to Microsoft's terms of service, usage frequency limits may exist
  4. SSML Limitations: Does not support complex SSML customization, only basic voice parameter adjustments are supported

Summary

Edge-TTS is a very practical text-to-speech tool that cleverly utilizes Microsoft Edge's online TTS service to provide users with a free, high-quality speech synthesis solution. Whether for personal use or project integration, it is a recommended tool. Its simple installation and usage, coupled with rich language support, make it an ideal choice for text-to-speech needs.