MyVocal新增公用音色列表与调用说明
详情请访问:https://my.feishu.cn/wiki/YMrZw7FWIiuSgskQS8tcihnKnph?from=from_copylink
系统将根据网络状况与负载自动选择最优节点
wss://api.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.us.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.eu.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocketwss://api.jp.voicelibrary.co/enterprise/v1/tts/{voice_id}/websocket| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model_id | string | ✅ | 使用的 TTS 模型 ID |
priority | string | ✅ | 必须为 dedicated_concurrency |
idleTimeout | number | 可选 | 最大 180 秒,无请求自动断开 |
language_code | string | 可选 | zh, en, ja, … |
format | string | 可选 | pcm_16000, pcm_8000, mp3 |
Timestamps | boolean | 可选 | 返回分词时间戳 |
directStreaming | boolean | 可选 | 使用二进制音频输出 |
api-key: <Your_API_Key>isFinal=true 时代表一段音频生成结束{
"text": " ",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
},
"generation_config": {
"synthesisSchedule": [120,160,250,290]
}
}说明:generation_config.synthesisSchedule(流式触发节奏)
synthesisSchedule = [120, 160, 250, 290]
| 数值较小 | 数值较大 |
|---|---|
| 延迟更低(更快听到声音) | 延迟更高(需要更多文本上下文) |
| 质量可能略低 | 质量更平 滑、自然、情绪更一致 |
{
"text": "hello world",
"earlyGeneration": false
}| 字段 | 类型 | 说明 |
|---|---|---|
text | string | 输入文本 |
earlyGeneration | boolean | 若为 true,服务端会更早开始合成 |
{"text": ""}{"text": "", "flush": true}flush=true 会立即触发 isFinal = true 的最后一个数据包。{
"audio": "/+MYxAAA....", // Base64 encoded audio
"isFinal": false
}"isFinal": trueconnect → initialization → text1 → isFinal → text2 → isFinal → text3 → isFinal → closeisFinal: null 且伴随音频数据,表示当前轮次的语音合成未显式结束(no isFinal: true),但 WebSocket 连接仍然保持可用状态,因此客户端 可以在同一连接中继续发送下一段 text,无需等待明确的结束信号。isFinal: null → 未显式结束,但不是错误,也不是阻塞态连接未关闭 = 可以继续写directStreaming=true 时:onMessage(ByteBuffer bytes) 中读取原始音频idleTimeout 控制{
"error": "service_error",
"message": "An error occurred while processing your request"
}| 错误码 | 说明 | 建议 |
|---|---|---|
service_error | 内部错误 | 可重试 |
unauthorized | API Key 无效 | 检查 Header |
model_not_found | 模型不存在 | 确保 model_id 正确 |
policy_violation | 控制帧异常(如过度 ping) | 移除自定义 ping |