doubao-tts · diff

v2.1.0 to v2.1.0

81 added, 81 removed. Audit A to A.

---
name: doubao-tts
version: 2.1.0
- description: 使用豆包语音合成(Volcengine TTS)将文本转为语音文件。当用户提到"豆包TTS"、"豆包语音合成"、"doubao tts"、"火山引擎TTS"、"volcengine tts"、"语音合成"、"文字转语音"、"TTS"、"生成音频"、"朗读文字",或任何需要调用豆包/火山引擎语音合成 API 的场景,必须触发本技能。
+ description: Use Doubao Text-to-Speech (Volcengine TTS) to convert text into audio files. When a user mentions "Doubao TTS," "Doubao Text-to-Speech," "doubao tts," "Volcengine TTS," "volcengine tts," "speech synthesis," "text-to-speech," "TTS," "generate audio," "read text aloud," or any scenario requiring the Doubao/Volcengine Text-to-Speech API, this skill must be triggered.
---
- # Doubao TTS Skill(V3)
+ # Doubao TTS Skill (V3)
- 使用火山引擎豆包语音合成 **V3 HTTP SSE 单向流式接口**将文本转为音频文件。
+ Use the Volcengine Doubao Text-to-Speech **V3 HTTP SSE unidirectional streaming API** to convert text into audio files.
- ## 获取 API Key(推荐,新版控制台)
+ ## Get an API Key (Recommended, New Console)
- 1. 登录 [火山引擎控制台](https://console.volcengine.com/speech/app)
- 2. 进入 **豆包语音 → 语音合成大模型 → 应用管理**
- 3. 创建应用(或使用已有应用)
- 4. 在 [API Key 管理](https://console.volcengine.com/speech/new/setting/apikeys?projectName=default) 页面获取 API Key → 对应 `DOUBAO_TTS_API_KEY`
+ 1. Log in to the [Volcengine Console](https://console.volcengine.com/speech/app)
+ 2. Go to **Doubao Voice → Text-to-Speech Large Model → Application Management**
+ 3. Create an application or use an existing one
+ 4. On the [API Key Management](https://console.volcengine.com/speech/new/setting/apikeys?projectName=default) page, get the API Key → corresponding to `DOUBAO_TTS_API_KEY`
- > 若尚未开通服务,需先在 [语音合成大模型](https://console.volcengine.com/speech/service/10) 页面开通。
+ > If you have not enabled the service yet, enable it first on the [Text-to-Speech Large Model](https://console.volcengine.com/speech/service/10) page.
- ### 旧版控制台(AppID + Token)
+ ### Legacy Console (AppID + Token)
- 旧版控制台应用详情页底部可获取:
+ At the bottom of the application details page in the legacy console, you can find:
- **APP ID** → `DOUBAO_TTS_APPID`
- **Access Token** → `DOUBAO_TTS_TOKEN`
- ## 环境变量
+ ## Environment Variables
- | 变量名 | 说明 | 推荐 |
+ | Variable Name | Description | Recommended |
|---|---|---|
- | `DOUBAO_TTS_API_KEY` | API Key(新版控制台,`X-Api-Key`) | ✅ |
- | `DOUBAO_TTS_APPID` | AppID(旧版控制台,`X-Api-App-Id`) | |
- | `DOUBAO_TTS_TOKEN` | Access Token(旧版控制台,`X-Api-Access-Key`) | |
- | `DOUBAO_TTS_RESOURCE_ID` | 资源 ID,留空默认 `seed-tts-2.0` | |
+ | `DOUBAO_TTS_API_KEY` | API Key (new console, `X-Api-Key`) | ✅ |
+ | `DOUBAO_TTS_APPID` | AppID (legacy console, `X-Api-App-Id`) | |
+ | `DOUBAO_TTS_TOKEN` | Access Token (legacy console, `X-Api-Access-Key`) | |
+ | `DOUBAO_TTS_RESOURCE_ID` | Resource ID; leave blank to use the default `seed-tts-2.0` | |
- 检查是否已配置:
+ Check whether they are configured:
```sh
[ -n "$DOUBAO_TTS_API_KEY" ] && echo "API_KEY: set" || echo "API_KEY: not set"
[ -n "$DOUBAO_TTS_APPID" ] && echo "APPID: set" || echo "APPID: not set"
[ -n "$DOUBAO_TTS_TOKEN" ] && echo "TOKEN: set" || echo "TOKEN: not set"
```
- 未配置时告知用户设置(优先使用 API Key):
+ If they are not configured, tell the user to set them (prefer API Key):
[Set DOUBAO_TTS_API_KEY](minis://settings/environments?create_key=DOUBAO_TTS_API_KEY&create_value=) | [Set DOUBAO_TTS_RESOURCE_ID](minis://settings/environments?create_key=DOUBAO_TTS_RESOURCE_ID&create_value=seed-tts-2.0)
- 旧版控制台(AppID + Token):
+ Legacy console (AppID + Token):
[Set DOUBAO_TTS_APPID](minis://settings/environments?create_key=DOUBAO_TTS_APPID&create_value=) | [Set DOUBAO_TTS_TOKEN](minis://settings/environments?create_key=DOUBAO_TTS_TOKEN&create_value=)
- ## 使用方式
+ ## Usage
- 调用脚本:`/var/minis/skills/doubao-tts/scripts/tts.py`
+ Call the script: `/var/minis/skills/doubao-tts/scripts/tts.py`
```sh
- # 基础用法
+ # Basic usage
uv run --script --cache-dir /root/.cache/uv \
/var/minis/skills/doubao-tts/scripts/tts.py \
- --text "你好,欢迎使用豆包语音合成" \
+ --text "Hello, and welcome to Doubao Text-to-Speech." \
--output /var/minis/workspace/output.mp3
- # 指定音色和语速
+ # Specify voice and speech rate
uv run --script --cache-dir /root/.cache/uv \
/var/minis/skills/doubao-tts/scripts/tts.py \
- --text "今天天气真好" \
+ --text "The weather is really nice today." \
--speaker zh_female_cancan_uranus_bigtts \
--speech-rate 10 \
--output /var/minis/workspace/output.mp3
- # 英文
+ # English
uv run --script --cache-dir /root/.cache/uv \
/var/minis/skills/doubao-tts/scripts/tts.py \
--text "Hello! Nice to meet you." \
--speaker en_female_dacey_uranus_bigtts \
--output /var/minis/workspace/output.mp3
```
- ## API 说明
+ ## API Description
- - **接口**:`https://openspeech.bytedance.com/api/v3/tts/unidirectional/sse`(SSE 流式)
- - **鉴权**(二选一):
- - 新版控制台:Header `X-Api-Key`(API Key)
- - 旧版控制台:Header `X-Api-App-Id` + `X-Api-Access-Key`(AppID + Token)
- - **Resource ID**:指定调用的模型版本(见下表)
- - **用量返回**:脚本默认携带 `X-Control-Require-Usage-Tokens-Return: text_words`,合成结束时返回计费字符数(`text_words`)
+ - **Endpoint**: `https://openspeech.bytedance.com/api/v3/tts/unidirectional/sse` (SSE streaming)
+ - **Authentication** (choose one):
+ - New console: Header `X-Api-Key` (API Key)
+ - Legacy console: Header `X-Api-App-Id` + `X-Api-Access-Key` (AppID + Token)
+ - **Resource ID**: Specifies the model version to call (see the table below)
+ - **Usage response**: The script includes `X-Control-Require-Usage-Tokens-Return: text_words` by default, which returns the number of billable characters (`text_words`) when synthesis ends
- | Resource ID | 说明 |
+ | Resource ID | Description |
|---|---|
- | `seed-tts-1.0` | 豆包语音合成模型 1.0 字符版(默认,兼容所有 `BV*_streaming` 音色) |
- | `seed-tts-1.0-concurr` | 豆包语音合成模型 1.0 并发版 |
- | `seed-tts-2.0` | 豆包语音合成模型 2.0(仅支持 2.0 音色) |
+ | `seed-tts-1.0` | Doubao Text-to-Speech Model 1.0 character version (default, compatible with all `BV*_streaming` voices) |
+ | `seed-tts-1.0-concurr` | Doubao Text-to-Speech Model 1.0 concurrency version |
+ | `seed-tts-2.0` | Doubao Text-to-Speech Model 2.0 (supports only 2.0 voices) |
- ## 参数说明
+ ## Parameters
- | 参数 | 说明 |
+ | Parameter | Description |
|---|---|
- | `--text` | 要合成的文本(必填) |
- | `--output` | 输出文件路径(必填) |
- | `--api-key` | API Key(新版控制台,优先于 APPID/TOKEN) |
- | `--appid` | AppID(旧版控制台) |
- | `--token` | Access Token(旧版控制台) |
- | `--speaker` | 音色,默认 `zh_female_shuangkuaisisi_uranus_bigtts`(爽快思思 2.0) |
- | `--encoding` | 格式:`mp3`/`pcm`/`ogg_opus`,默认 `mp3` |
- | `--speech-rate` | 语速 [-50, 100],0 为默认,100 为 2 倍速 |
- | `--loudness` | 音量 [-50, 100],0 为默认 |
- | `--sample-rate` | 采样率,默认 24000 |
- | `--emotion` | 情感(如 `happy`/`sad`/`angry`/`narrator` 等) |
- | `--emotion-scale` | 情绪强度 [1, 5](配合 `--emotion` 使用) |
- | `--resource-id` | Resource ID(覆盖环境变量) |
- | `--json` | JSON 格式输出结果 |
+ | `--text` | Text to synthesize (required) |
+ | `--output` | Output file path (required) |
+ | `--api-key` | API Key (new console, takes precedence over APPID/TOKEN) |
+ | `--appid` | AppID (legacy console) |
+ | `--token` | Access Token (legacy console) |
+ | `--speaker` | Voice, default `zh_female_shuangkuaisisi_uranus_bigtts` (Shuangkuai Sisi 2.0) |
+ | `--encoding` | Format: `mp3`/`pcm`/`ogg_opus`, default `mp3` |
+ | `--speech-rate` | Speech rate [-50, 100], where 0 is the default and 100 is 2x speed |
+ | `--loudness` | Volume [-50, 100], where 0 is the default |
+ | `--sample-rate` | Sample rate, default 24000 |
+ | `--emotion` | Emotion, such as `happy`/`sad`/`angry`/`narrator` |
+ | `--emotion-scale` | Emotion intensity [1, 5] (used with `--emotion`) |
+ | `--resource-id` | Resource ID (overrides the environment variable) |
+ | `--json` | Output result in JSON format |
- ## 常用音色速查
+ ## Quick Reference for Common Voices
- ### 豆包语音合成模型 2.0(`seed-tts-2.0`,推荐)
+ ### Doubao Text-to-Speech Model 2.0 (`seed-tts-2.0`, recommended)
- | speaker | 名称 | 场景 |
+ | speaker | Name | Scenario |
|---|---|---|
- | `zh_female_shuangkuaisisi_uranus_bigtts` | 爽快思思 2.0 ⭐默认 | 通用 |
- | `zh_female_cancan_uranus_bigtts` | 知性灿灿 2.0 | 角色扮演 |
- | `zh_female_tianmeixiaoyuan_uranus_bigtts` | 甜美小源 2.0 | 通用 |
- | `zh_female_vv_uranus_bigtts` | Vivi 2.0 | 通用,中/日/印尼/墨西哥西语,方言川陕东北 |
- | `zh_female_xiaohe_uranus_bigtts` | 小何 2.0 | 通用 |
- | `zh_male_m191_uranus_bigtts` | 云舟 2.0 | 通用 |
- | `zh_male_taocheng_uranus_bigtts` | 小天 2.0 | 通用 |
- | `zh_female_kefunvsheng_uranus_bigtts` | 暖阳女声 2.0 | 客服 |
- | `en_female_dacey_uranus_bigtts` | Dacey | 多语种(英) |
- | `en_male_tim_uranus_bigtts` | Tim | 多语种(英) |
+ | `zh_female_shuangkuaisisi_uranus_bigtts` | Shuangkuai Sisi 2.0 ⭐ Default | General |
+ | `zh_female_cancan_uranus_bigtts` | Zhixing Cancan 2.0 | Role-playing |
+ | `zh_female_tianmeixiaoyuan_uranus_bigtts` | Tianmei Xiaoyuan 2.0 | General |
+ | `zh_female_vv_uranus_bigtts` | Vivi 2.0 | General, Chinese/Japanese/Indonesian/Mexican Spanish, Sichuan/Shaanxi/Northeastern dialects |
+ | `zh_female_xiaohe_uranus_bigtts` | Xiaohe 2.0 | General |
+ | `zh_male_m191_uranus_bigtts` | Yunzhou 2.0 | General |
+ | `zh_male_taocheng_uranus_bigtts` | Xiaotian 2.0 | General |
+ | `zh_female_kefunvsheng_uranus_bigtts` | Nuanyang Female Voice 2.0 | Customer service |
+ | `en_female_dacey_uranus_bigtts` | Dacey | Multilingual (English) |
+ | `en_male_tim_uranus_bigtts` | Tim | Multilingual (English) |
- ### 豆包语音合成模型 1.0(`seed-tts-1.0`,需改 `--resource-id`)
+ ### Doubao Text-to-Speech Model 1.0 (`seed-tts-1.0`, requires changing `--resource-id`)
- | speaker | 名称 | 场景 |
+ | speaker | Name | Scenario |
|---|---|---|
- | `BV700_streaming` | 灿灿 | 通用,支持22种情感 |
- | `BV001_streaming` | 通用女声 | 通用 |
- | `BV002_streaming` | 通用男声 | 通用 |
- | `BV701_streaming` | 擎苍 | 有声阅读 |
- | `BV503_streaming` | 活力女声-Ariana | 英语 |
+ | `BV700_streaming` | Cancan | General, supports 22 emotions |
+ | `BV001_streaming` | General Female Voice | General |
+ | `BV002_streaming` | General Male Voice | General |
+ | `BV701_streaming` | Qingcang | Audiobook |
+ | `BV503_streaming` | Energetic Female Voice-Ariana | English |
- > ⚠️ 1.0 和 2.0 音色不能混用,`seed-tts-2.0` 只支持 `*_uranus_bigtts` 结尾的音色
+ > ⚠️ 1.0 and 2.0 voices cannot be mixed. `seed-tts-2.0` supports only voices ending in `*_uranus_bigtts`.
- ## 常见情感值
+ ## Common Emotion Values
- `pleased`(愉悦) / `sorry`(抱歉) / `happy`(开心) / `sad`(悲伤) / `angry`(愤怒) / `scare`(害怕) / `surprise`(惊讶) / `hate`(厌恶) / `tear`(哭腔) / `narrator`(旁白) / `storytelling`(讲故事)
+ `pleased` (pleased) / `sorry` (sorry) / `happy` (happy) / `sad` (sad) / `angry` (angry) / `scare` (scared) / `surprise` (surprised) / `hate` (disgust) / `tear` (tearful voice) / `narrator` (narrator) / `storytelling` (storytelling)
- ## 完整工作流
+ ## Complete Workflow
- 1. 检查环境变量是否配置(优先 `DOUBAO_TTS_API_KEY`,其次 `DOUBAO_TTS_APPID` + `DOUBAO_TTS_TOKEN`)
- 2. 调用 `tts.py` 脚本生成音频文件到 `/var/minis/workspace/`
- 3. 以 `minis://workspace/xxx.mp3` 链接形式返回给用户,可直接点击播放
+ 1. Check whether environment variables are configured (first `DOUBAO_TTS_API_KEY`, then `DOUBAO_TTS_APPID` + `DOUBAO_TTS_TOKEN`)
+ 2. Call the `tts.py` script to generate an audio file in `/var/minis/workspace/`
+ 3. Return it to the user as a `minis://workspace/xxx.mp3` link, which they can click to play directly.