Skip to content
プロジェクト

概要

Microsoft Edgeのオンライン音声合成に対応したPythonライブラリおよびCLI。ニューラル音声、MP3出力、SRT字幕を利用できます。EdgeもAPIキーも必要ありません。

AI・機械学習

この数値の測り方

計測したスター増加

24時間
+4
7日間
+50
15日間
+130
1か月
+260

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

edge-tts

edge-tts lets you use Microsoft Edge's online text-to-speech service from Python, or from the command line with the edge-tts and edge-playback commands.

Installation

$ uv add edge-tts          # or: pip install edge-tts

To use only the commands, install them as a tool, or run them without installing:

$ uv tool install edge-tts
$ uvx edge-tts --text "Hello, world!" --write-media hello.mp3

Command line

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

To play the speech back immediately, use edge-playback, which takes the same options except --write-media, --write-subtitles and --list-voices. It requires mpv, except on Windows.

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

List the available voices with --list-voices, and pick one with --voice:

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

Adjust the speech with --rate, --volume and --pitch. Write negative values with =, so they aren't read as options:

$ edge-tts --rate=-50% --pitch=-5Hz --text "Hello, world!" --write-media hello.mp3

Run edge-tts --help for all options. Custom SSML isn't supported, because the service only accepts the SSML that Microsoft Edge itself generates.

Python

import edge_tts

edge_tts.Communicate("Hello, world!", "en-GB-SoniaNeural").save_sync("hello.mp3")

See examples/ for async usage, streaming, subtitles and voice selection.

Troubleshooting

See TROUBLESHOOTING.md for common errors, such as NoAudioReceived, and how to deal with them.

Development

uv sync                            # create the environment from uv.lock
uv run pre-commit install          # lint, format and type-check on every commit
uv run pytest

Releases are published to PyPI automatically when a GitHub release is created.

関連プロジェクトを探す

読み込み中…