aliyun-tts
Alibaba Cloud Text-to-Speech synthesis service.
Configuration
Set the following environment variables:
- -
ALIYUN_APP_KEY - Application Key - INLINECODE1 - Access Key ID
- INLINECODE2 - Access Key Secret (sensitive)
Option 1: CLI configuration (recommended)
CODEBLOCK0
Option 2: Manual configuration
Edit ~/.clawdbot/clawdbot.json:
CODEBLOCK1
Usage
CODEBLOCK2
Options
| Flag | Description | Default |
|---|
| INLINECODE4 | Output file path | tts.mp3 |
| INLINECODE5 |
Voice name | siyue |
|
-f, --format | Audio format | mp3 |
|
-r, --sample-rate | Sample rate | 16000 |
Available Voices
Common voices: siyue, xiaoxuan, xiaoyun, etc. See Alibaba Cloud documentation for the full list.
Chat Voice Replies
When a user requests a voice reply:
CODEBLOCK3
aliyun-tts
阿里云文本转语音合成服务。
配置
设置以下环境变量:
- - ALIYUNAPPKEY - 应用密钥
- ALIYUNACCESSKEYID - 访问密钥ID
- ALIYUNACCESSKEYSECRET - 访问密钥Secret(敏感信息)
方式一:CLI配置(推荐)
bash
配置应用密钥
clawdbot skills config aliyun-tts ALIYUN
APPKEY your-app-key
配置访问密钥ID
clawdbot skills config aliyun-tts ALIYUN
ACCESSKEY_ID your-access-key-id
配置访问密钥Secret(敏感信息)
clawdbot skills config aliyun-tts ALIYUN
ACCESSKEY_SECRET your-access-key-secret
方式二:手动配置
编辑 ~/.clawdbot/clawdbot.json:
json5
{
skills: {
entries: {
aliyun-tts: {
env: {
ALIYUNAPPKEY: your-app-key,
ALIYUNACCESSKEY_ID: your-access-key-id,
ALIYUNACCESSKEY_SECRET: your-access-key-secret
}
}
}
}
}
使用方法
bash
基本用法
{baseDir}/bin/aliyun-tts 你好,这是阿里云TTS
指定输出文件
{baseDir}/bin/aliyun-tts -o /tmp/voice.mp3 你好
指定音色
{baseDir}/bin/aliyun-tts -v siyue 使用思悦音色
指定格式和采样率
{baseDir}/bin/aliyun-tts -f mp3 -r 16000 音频参数
选项
| 标志 | 描述 | 默认值 |
|---|
| -o, --output | 输出文件路径 | tts.mp3 |
| -v, --voice |
音色名称 | siyue |
| -f, --format | 音频格式 | mp3 |
| -r, --sample-rate | 采样率 | 16000 |
可用音色
常用音色:siyue、xiaoxuan、xiaoyun等。完整列表请参考阿里云文档。
聊天语音回复
当用户请求语音回复时:
bash
生成音频
{baseDir}/bin/aliyun-tts -o /tmp/voice-reply.mp3 您的回复内容
在回复中包含:
MEDIA:/tmp/voice-reply.mp3