SuperAPI AI 工具集

google-tts

通用与其它

查看项目

更新于 10-15 21:33

技能介绍

用途:把文本或文档转换成音频,适合文档朗读、旁白生成和双人播客制作。

主要能力:调用 Google Cloud TTS,支持 Neural2、WaveNet、Studio、Standard 音色及 40 多种语言;可从文本或 PDF、DOCX、MD、TXT 文件生成音频;支持指定音色、语速、音调和编码;可用含交替发言人的 JSON 脚本合成多音色播客。

使用方式:设置 GOOGLE_TTS_API_KEY 环境变量,或写入 skills/google-tts/config.json 的 api_key。多块文档需要 ffmpeg;处理 PDF/DOCX 可选安装 PyPDF2 与 python-docx。常用命令:

python skills/google-tts/scripts/google_tts.py voices --language en-US --type Neural2 python skills/google-tts/scripts/google_tts.py tts --text "Hello world" --output ~/Downloads/hello.mp3 python skills/google-tts/scripts/google_tts.py tts --file /path/to/doc.pdf --output ~/Downloads/narration.mp3 python skills/google-tts/scripts/google_tts.py tts --file doc.md --voice en-US-Neural2-F --rate 0.9 --encoding MP3 --output ~/Downloads/out.mp3 python skills/google-tts/scripts/google_tts.py podcast --script /tmp/script.json --voice1 en-US-Neural2-J --voice2 en-US-Neural2-H --rate 0.9 --output ~/Downloads/podcast.mp3

适用场景:单音色文档旁白,以及从文档提取文本后生成双主持对话式播客。默认输出到 ~/Downloads/。

限制:API 单次请求上限 5000 字节,脚本会在句子边界自动分块;语速范围 0.25-4.0,音调 -20.0 到 20.0 半音;编码可选 MP3、LINEAR16、OGG_OPUS。资料未提供更多平台支持、错误处理和完整限制说明。