Install
openclaw skills install @fackee/doubao-ttsCall the Volcano Engine Doubao Large Model Speech Synthesis V3 API to perform text-to-speech (TTS) and voice cloning. Supports public/cloned voice synthesis, configurable speech rate/volume/emotion/language, and training cloned voices from audio samples. Use this skill when users need to convert text to speech, synthesize audio, clone voices, or replicate voice timbres.
openclaw skills install @fackee/doubao-ttsBased on the Volcano Engine Doubao Large Model Speech Synthesis V3 API, providing two scripts:
scripts/clone_voice.py: Train a cloned voice from an audio samplescripts/tts.py: Synthesize text into an audio file1. Install Dependencies
pip install requests
2. Obtain Authentication Credentials
Using the new console is recommended; it only requires one API Key:
The legacy console requires App ID + Access Key (or App Key + Access Key).
export DOUBAO_API_KEY=$DOUBAO_API_KEY
3. Enable Services
Upload an audio sample to train a cloned voice. After successful training, you will receive a speaker_id that can be used for TTS synthesis.
Prepaid voice (requires purchasing a voice slot in the console first):
# New console authentication (recommended)
python3 scripts/clone_voice.py \
--api-key "your-api-key" \
--speaker-id "S_xxxxxxx" \
--audio "sample.wav" \
--language 0
# Continuously poll until training is complete
python3 scripts/clone_voice.py \
--api-key "your-api-key" \
--speaker-id "S_xxxxxxx" \
--audio "sample.wav" \
--poll
Postpaid voice (custom voice ID, first synthesis incurs a charge):
python3 scripts/clone_voice.py \
--api-key "your-api-key" \
--custom-speaker-id "custom_zh_myvoice" \
--audio "sample.wav" \
--language 0 \
--demo-text "Hello, this is my cloned voice." \
--poll
Enable denoising when audio has significant background noise:
python3 scripts/clone_voice.py \
--api-key "your-api-key" \
--speaker-id "S_xxxxxxx" \
--audio "noisy_sample.mp3" \
--denoise \
--poll
Legacy console authentication:
python3 scripts/clone_voice.py \
--app-key "your-app-key" \
--access-key "your-access-key" \
--speaker-id "S_xxxxxxx" \
--audio "sample.wav"
| status | Meaning |
|---|---|
| 0 | NotFound (not found) |
| 1 | Training (in progress) |
| 2 | Success (training complete, available for synthesis) |
| 3 | Failed (training failed) |
| 4 | Active (activated, available for synthesis) |
When status is 2 or 4, the speaker_id can be used for TTS synthesis.
| Parameter | Description | Default |
|---|---|---|
--api-key | New console API Key (recommended) | - |
--app-key | Legacy console App Key | - |
--access-key | Legacy console Access Key | - |
--speaker-id | Prepaid voice ID (e.g. S_xxxxxxx) | - |
--custom-speaker-id | Postpaid custom voice ID | - |
--audio | Audio file path | Required |
--language | Language: 0=Chinese 1=English 2=Japanese 3=Spanish 4=Indonesian 5=Portuguese 8=Korean | 0 |
--denoise | Enable denoising | Off |
--demo-text | Demo text for preview (4~300 characters) | None |
--poll | Continuously poll until training is complete | Query once only |
--poll-interval | Polling interval (seconds) | 10 |
Synthesize text into an audio file, supporting public voices and cloned voices, with configurable speech rate/volume/emotion, etc.
Basic synthesis (public voice):
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "zh_female_shuangkuaisisi_moon_bigtts" \
--text "Hello, welcome to the Doubao speech synthesis service." \
--output "hello.mp3"
Using a cloned voice:
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "S_xxxxxxx" \
--resource-id "seed-icl-2.0" \
--text "This is audio synthesized using my cloned voice." \
--output "cloned.mp3"
Reading long text from a file:
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "zh_female_shuangkuaisisi_moon_bigtts" \
--text-file "article.txt" \
--output "article.mp3"
Adjusting speech rate, volume, and emotion:
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "zh_female_shuangkuaisisi_moon_bigtts" \
--text "I am so happy today!" \
--speech-rate 20 \
--loudness 10 \
--emotion "happy" \
--output "happy.mp3"
Output WAV format + return timestamps:
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "zh_female_shuangkuaisisi_moon_bigtts" \
--text "This passage will include subtitle timestamps." \
--format "wav" \
--sample-rate 44100 \
--timestamps \
--output "output.wav"
Legacy console authentication:
python3 scripts/tts.py \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "zh_female_shuangkuaisisi_moon_bigtts" \
--text "Hello world" \
--output "hello.mp3"
| Parameter | Description | Default |
|---|---|---|
--api-key | New console API Key (recommended) | - |
--app-id | Legacy console App ID (for TTS authentication) | - |
--access-key | Legacy console Access Key | - |
--speaker | Voice ID (required) | Required |
--resource-id | Resource ID | seed-tts-1.0 |
--text | Text to synthesize (up to 100,000 characters) | - |
--text-file | Read text from file | - |
--format | Audio format: mp3/ogg_opus/pcm/wav | mp3 |
--sample-rate | Sample rate | 24000 |
--speech-rate | Speech rate [-50, 100], 100=2x speed | 0 |
--loudness | Volume [-50, 100], 100=2x volume | 0 |
--emotion | Emotion (e.g. happy/sad/angry, requires voice support) | None |
--language | Explicit language (zh-cn/en/crosslingual, etc.) | None |
--timestamps | Return subtitle timestamps | Off |
--output | Output file path | output.mp3 |
--poll-interval | Polling interval (seconds) | 5 |
| Resource ID | Applicable Voices |
|---|---|
seed-tts-1.0 | Doubao Speech Synthesis Model 1.0 public voices |
seed-tts-2.0 | Doubao Speech Synthesis Model 2.0 public voices |
seed-icl-1.0 | Voice Cloning 1.0 cloned voices |
seed-icl-2.0 | Voice Cloning 2.0 cloned voices |
# Step 1: Train a cloned voice (wait for completion)
python3 scripts/clone_voice.py \
--api-key "your-api-key" \
--custom-speaker-id "custom_zh_myvoice01" \
--audio "my_voice.wav" \
--language 0 \
--poll
# Step 2: Synthesize text using the cloned voice
python3 scripts/tts.py \
--api-key "your-api-key" \
--app-id "your-app-id" \
--access-key "your-access-key" \
--speaker "custom_zh_myvoice01" \
--resource-id "seed-icl-2.0" \
--text "This is audio generated with my cloned voice, does it sound like me?" \
--output "my_cloned_voice.mp3"