doubao-tts
它能做什么
这项技能使用豆包语音服务制作配音旁白。适合需要中文或多语言旁白,或更倾向于豆包语音服务的创作者。
适用场景
- ✓当你的视频需要中文配音时。
- ✓当你更倾向于使用豆包或 Volcengine 语音服务来制作旁白时。
- ✓当你需要每个词或字的时间数据来制作字幕时。
技能链接
https://github.com/calesthio/OpenMontage/blob/main/.agents/skills/doubao-tts/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为这段脚本制作一段普通话配音,并给出字幕所需的时间数据。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把文字和所选声音发送给豆包语音服务。较长的旁白会使用后台任务处理,然后返回音频,以及每句和每个词的时间数据。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Doubao TTS
Requires DOUBAO_SPEECH_API_KEY in .env.
Set DOUBAO_SPEECH_VOICE_TYPE for the default voice, or pass voice_id to the tool.
Current API
Use the new-console API key flow:
X-Api-Key: ${DOUBAO_SPEECH_API_KEY}
X-Api-Resource-Id: seed-tts-2.0
Do not use X-Api-App-Id and X-Api-Access-Key with a new-console API Key. If the API returns load grant: requested grant not found, the key type or auth header is probably wrong.
For long-form video narration, prefer the async endpoint:
POST https://openspeech.bytedance.com/api/v3/tts/submit
POST https://openspeech.bytedance.com/api/v3/tts/query
This returns audio_url plus sentences[].words[] timing metadata that can be used to build subtitles.
OpenMontage Usage
Generate with the TTS selector:
from tools.audio.tts_selector import TTSSelector
result = TTSSelector().execute({
"preferred_provider": "doubao",
"text": "如果 AI 真的会改变未来,普通人到底该怎么参与?",
"voice_id": "zh_female_vv_uranus_bigtts",
"output_path": "projects/my-video/assets/audio/narration.mp3",
"speech_rate": 0,
"enable_timestamp": True,
})
Or call the provider directly:
from tools.audio.doubao_tts import DoubaoTTS
result = DoubaoTTS().execute({
"text": "短样本试听文本。",
"voice_id": "zh_female_vv_uranus_bigtts",
"output_path": "projects/my-video/assets/audio/doubao_sample.mp3",
})
The provider writes:
output_path: downloaded audio filemetadata_path: full query response JSON, defaulting to<output_path>.json
Recommended Workflow
- Generate a 10-15 second sample before a full paid narration.
- Ask the user to approve voice naturalness, accent, and speed.
- Generate the full narration only after approval.
- Keep the query JSON. It is the source of truth for subtitle timing.
- Build captions from
sentences[].words[], not from estimated text length. - Group captions by Chinese semantic phrases before applying timestamps. Do not split only by fixed character count; it can break phrases like "在不押单个公司的情况下" or "可能会被慢慢稀释" and hurt comprehension.
- Let the video duration follow the approved voice rhythm unless the user explicitly asks to match a prior runtime.
Parameters
voice_id: Doubaospeaker/ voice type. Defaults toDOUBAO_SPEECH_VOICE_TYPE.resource_id: useseed-tts-2.0for Doubao Speech 2.0 voices.speech_rate:0is normal,100is 2x,-50is 0.5x.sample_rate: default24000.enable_timestamp: defaulttrue.return_usage: defaulttrue, requests usage metadata when available.
Do not pass additions.explicit_language by default. Some endpoint/key combinations reject zh-cn with unsupported additions explicit language zh-cn.
For calm Mandarin explainers, start with speech_rate: 0. If the result is too long for the approved format, make a short comparison sample with speech_rate: 25 or 50 before regenerating the full narration. Do not speed up only to match a previous provider's duration if the user prefers Doubao's natural pace.
Troubleshooting
load grant: requested grant not found: wrong key type or wrong auth header. UseX-Api-Keyfor new-console API Keys.speaker permission denied: voice id is wrong or not authorized for the selected resource.quota exceeded: quota, lifetime characters, or concurrency exceeded.- Missing timestamps: verify
enable_timestamp: true, keep the query JSON, and confirm the selected endpoint returnedsentences.
Safety
Never print or write the API key to logs, metadata, patches, or project artifacts. .env.example should contain only empty variable names.
常见问题
我需要先做哪些设置?
你需要在 .env 文件中设置 DOUBAO_SPEECH_API_KEY,还可以设置默认声音。
有字幕所需的时间数据吗?
有。较长旁白的选项会返回每句和每个词的时间。
如果出现 grant 错误怎么办?
这项技能提示,密钥类型或授权请求头可能有误,请检查密钥类型。
详情
作者的原始描述
Generate Mandarin and multilingual narration with Volcengine Doubao Speech 2.0. Use when creating Chinese voiceovers, when the user prefers Doubao/Volcengine/火山引擎/豆包 TTS, or when narration needs character-level timestamp metadata for subtitles.
repo: calesthio/OpenMontage
热度
- GitHub 星标
- 75k
- 排名
- #2651
- 许可证
- AGPL-3.0
- 更新时间
- 2026/10/28
评论
- …