用途:将文本合成为语音,调用字节跳动火山引擎 TTS V3 HTTP 流式接口。
主要能力:支持 100+ 音色、多情感音色、语速调节(0.1-2.0),输出格式可选 mp3、wav、pcm、ogg_opus。
使用方式:先设置环境变量 export DOUBAO_APPID="your-appid" 与 export DOUBAO_TOKEN="your-access-token",并安装依赖 pip install requests。基本调用:python {baseDir}/scripts/tts.py --text "Hello, this is a test." --output output.mp3。常用参数:--text(必填,最大 1024 字节,建议少于 300 字符)、--voice_type(默认 zh_female_cancan_mars_bigtts)、--encoding(默认 mp3)、--output、--speed_ratio(默认 1.0)、--emotion(仅部分音色支持)。完整音色列表见 VOICES.md。
接口信息:端点 https://openspeech.bytedance.com/api/v3/tts/unidirectional,HTTP POST 流式响应,鉴权头 Authorization: Bearer; {token}。
限制:文本过长需拆分(错误码 3010);并发超限需重试(3003);音色不存在报 3050;情感仅对支持的多情感音色生效。具体收费、价格与平台信息暂未提供。