Appearance
TTS 异步生成文档
请求地址以及请求头
注意:本文档下所有请求均使用POST方法
公共请求头
参数 | 值 |
---|---|
Authorization | Bearer apiKey |
Content-Type | application/json |
apiKey 为用户的API key,可在客户端中生成
1-1.获取音色列表
/v1/getTTSTimbreList
请求参数
{"pageIndex":1,"pageSize":100}
返回值
字段 | 备注 |
---|---|
id | 音色ID |
grade | premium 多语态;ordinary 单语态 |
gender | 0女;1男; |
voiceUrl | 试听音频 |
json
{
"code": 200,
"success": true,
"msg": "操作成功",
"data": {
"total": 1,
"list": [
{
"id": "30002",
"grade": "premium",
"isOfficial": true,
"name": "智吾褚",
"description": "中青年 稳重 温暖",
"gender": 1,
"avatar": "https://public.dubbingx.com/avatar/10092/20240329-143217.png",
"voiceUrl": "https://public.dubbingx.com/audition/10092/mujin.wav",
"status": true,
"createTime": "2023-11-03 18:24:12"
}
]
},
"time": "2024-04-10 16:24:55",
"traceId": "1777976038257512450"
}
1-2. 根据文本分析情绪并返回(可选)
/v2/analyzeEmotion
接口字段 | 备注 |
---|---|
text | 需要分析的文本内容 |
示例:
json
{
"text": "今天天气真好!!"
}
返回值
字段 | 备注 |
---|---|
data | 返回的情绪以及档位 |
json
{
"code": 200,
"success": true,
"msg": "操作成功",
"data": "开心-正常-3",
"time": "2024-09-02 11:23:05",
"traceId": "1830446316581281793"
}
2.发送TTS合成指令(异步返回结果)
/v2/addTtsTask
V2版本使用SSML格式
接口字段 | 备注 |
---|---|
text | 拼接SSML格式的字符串 |
SSML字段 | 备注 |
---|---|
voiceId | getTTSTimbreList获取的音色ID |
emotion | https://public.dubbingx.com/emotion/emotion_language.json 下的各个情绪,每个情绪有5档,单语态下无需传递,多语态下传空支持自动情绪识别 |
language | zh;jp;en;yue;分别表示中,日,英,粤语 |
audioPitch | 语调,1.0为原音高,0.7到1.3 |
audioSpeed | 语速,1.0为原语速,0.7到1.3 |
phoneme | 音素标注,只支持中文,包裹内只支持一个文字,多个文字请分多次包裹,格式为<phoneme ph="duan2">段</phoneme> |
fileType | 音频格式,支持wav,mp3,不传默认为wav |
示例: |
json
{
"text": "<speak voiceId=\"30065\" language=\"zh\" emotion=\"常规-日常说话-3\" audioPitch=\"1.1\" audioSpeed=\"1.1\">这是一<phoneme ph=\"duan2\">段</phoneme>测试音频!</speak>"
}
返回值
字段 | 备注 |
---|---|
taskId | 添加任务成功后会返回任务id |
json
{
"code": 200,
"success": true,
"msg": "操作成功",
"data": {
"taskId": "1778319033905385473"
},
"time": "2024-04-11 15:07:52",
"traceId": "1778319033238491137"
}
3.获取合成状态
v1/getTtsTaskInfo/${taskId}
请求参数 将taskId拼在最后
返回数据
字段 | 备注 |
---|---|
status | Ready 待合成, Transitioning 合成中,Completed 已完成,Failed 合成失败,当状态为Completed时,fileUrl将返回合成后的音频下载地址 |
json
{
"code": 200,
"success": true,
"msg": "操作成功",
"data": {
"id": "1778319033905385473",
"status": "Completed",
"language": "zh",
"fileName": "dce642383ca447b3ac4ed57cd3e5b2b4.wav",
"fileUrl": "https://tts-bucket.dubbingx.com/10092/30002/dce642383ca447b3ac4ed57cd3e5b2b4.wav?Expires=1712849799&OSSAccessKeyId=LTAI5t8FMBqtNy467wQoCC3t&Signature=x7wCkhlQlCI8DPNdP8kLoPkvk0w%3D",
"updateTime": "2024-04-11 15:07:59",
"createTime": "2024-04-11 15:07:52"
},
"time": "2024-04-11 15:36:39",
"traceId": "1778326277661331458"
}
3-1.批量获取合成状态
v1/getTtsTaskListInfo
请求参数
json
["1778328789218971650","1778328790586314754","1778328790703755265","1778328790888304642"]
传递taskId数组
json
{
"code": 200,
"success": true,
"msg": "操作成功",
"data": [
{
"id": "1778328789218971650",
"status": "Completed",
"language": "zh",
"fileName": "61a74e1801ef4984ac0c911e815efaa1.wav",
"fileUrl": "",
"updateTime": "2024-04-11 15:46:43",
"createTime": "2024-04-11 15:46:38"
},
{
"id": "1778328790586314754",
"status": "Completed",
"language": "zh",
"fileName": "eb80e60b17bc457db8e37fe0051fd020.wav",
"fileUrl": "",
"updateTime": "2024-04-11 15:46:46",
"createTime": "2024-04-11 15:46:38"
},
{
"id": "1778328790703755265",
"status": "Completed",
"language": "zh",
"fileName": "e74b9d83d1134aafb1b82a9626166756.wav",
"fileUrl": "",
"updateTime": "2024-04-11 15:46:48",
"createTime": "2024-04-11 15:46:38"
},
{
"id": "1778328790888304642",
"status": "Completed",
"language": "zh",
"fileName": "52ec6be56d2346a6a9847553d51c5094.wav",
"fileUrl": "",
"updateTime": "2024-04-11 15:46:51",
"createTime": "2024-04-11 15:46:38"
}
],
"time": "2024-04-11 15:47:43",
"traceId": "1778329063622889474"
}
商务合作洽谈、优惠领取,请致电
廖经理 +86-18758246772 liaowenguo@dubbingx.com
黄经理 +86-13091911143 huangbai@dubbingx.com
培荣 +86-13645716337 huangpeirong@dubbingx.com