
edge-tts
CLI调用微软 Edge 在线语音合成把文本转成语音,并可同时生成字幕文件,无需 API Key,支持中文等多语种音色。非微软官方项目,依赖该在线服务的可用性。
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.
相关资源

notebooklm-py
CLI非官方 Python 库与 CLI,让 agent 操控 Google NotebookLM(现更名 Gemini Notebook):批量导入资料、基于来源带引用问答,生成播客、视频、幻灯片、测验与闪卡并批量下载,自带 agent skill。依赖未公开接口,需登录 Google 账号。
teng-lin/notebooklm-py20.4k
MLX-Audio
CLI在 Apple Silicon Mac 上离线运行的语音工具:命令行把文字合成语音(支持中文与声音克隆)、把录音转写成文字,可为课件和讲解视频配音、整理讲座与访谈录音,数据不出本机。需要 M 系列芯片 Mac 与 Python 3.10+,导出 MP3 需装 ffmpeg,首次运行会下载模型。
Blaizzy/mlx-audio8.4k
whisper-ctranslate2
CLI本地语音转写工具,与 OpenAI Whisper 命令行兼容但更快更省内存,可输出 SRT / VTT 字幕与文本,支持麦克风实时转写,适合整理课堂录音、访谈与会议。需要 Python,首次运行自动下载模型;区分说话人需另装 pyannote.audio 并提供 Hugging Face Token。
Softcatala/whisper-ctranslate21.4k
Podcastfy
CLI开源的 NotebookLM 播客功能替代品,把网页、PDF、图片、YouTube 视频或文字转成两人对话式播客音频,适合老师把讲义、作者把文章做成音频节目。默认需要 Gemini 与 OpenAI API Key,也可用本地模型加免费的 Edge 语音。
souzatharsis/podcastfy6.9k
Piper
CLI本地运行的神经网络语音合成引擎,离线把文字转成语音,支持中文在内的数十种语言音色,适合老师制作听力材料、给文章或课件配旁白。需要 Python,首次使用要先下载对应音色模型;项目目前在招募维护者。
OHF-Voice/piper1-gpl6.5k
Kokoro TTS
CLI基于开源 Kokoro 模型的本地语音合成命令行工具,能把 TXT、EPUB、PDF 按章节批量转成 MP3 或 WAV,支持中文、音色混合和调速,适合老师做听力材料、把讲义转成有声版。需要 Python 3.11–3.12,并先下载两个模型文件。
nazdridoy/kokoro-tts2.1k