CreateMediaTemplate 用于新增语音合成模板。
POST /template HTTP/1.1
Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Content-Length: <length>
Content-Type: application/xml
<body>
说明:Authorization: Auth String (详情请参见 请求签名 文档)。
此接口仅使用公共请求头部,详情请参见 公共请求头部 文档。
该请求操作的实现需要有如下请求体。
<Request>
<Tag>Tts</Tag>
<Name>TemplateName</Name>
<Mode>Sync</Mode>
<Codec>pcm</Codec>
<VoiceType>ruxue</VoiceType>
<Volume>2</Volume>
<Speed>200</Speed>
</Request>
具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 |
---|---|---|---|---|
Request | 无 | 保存请求的容器 | Container | 是 |
Container 类型 Request 的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 | 限制 |
---|---|---|---|---|---|
Tag | Request | 模板类型:Tts | String | 是 | Tts |
Name | Request | 模板名称,仅支持中文、英文、数字、_、-和* | String | 是 | 无 |
Mode | Request | 处理模式,默认值Asyc | String | 否 | Asyc(异步合成)、Sync(同步合成) 当选择 Asyc 时,codec 只支持 pcm |
Codec | Request | 音频格式,默认值 wav(同步)/pcm(异步) | String | 否 | wav、mp3、pcm |
VoiceType | Request | 音色,默认值 ruxue | String | 否 | ruxue、aixiaonan |
Volume | Request | 音量,默认值0 | String | 否 | [-10,10] |
Speed | Request | 语速,默认值100 | String | 否 | [50,200] |
此接口仅返回公共响应头部,详情请参见 公共响应头部 文档。
该响应体返回为 application/xml 数据,包含完整节点数据的内容展示如下:
<Response>
<Template>
<Tag>Tts</Tag>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Name>TemplateName</Name>
<TtsTpl>
<Mode>Sync</Mode>
<Codec>pcm</Codec>
<VoiceType>ruxue</VoiceType>
<Volume>2</Volume>
<Speed>200</Speed>
</TtsTpl>
<CreateTime>2020-08-05T11:35:24+0800</CreateTime>
<UpdateTime>2020-08-31T16:15:20+0800</UpdateTime>
</Template>
</Response>
具体的数据内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
---|---|---|---|
Response | 无 | 保存结果的容器 | Container |
Container 节点 Response 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
---|---|---|---|
TemplateId | Response.Template | 模板 ID | String |
Name | Response.Template | 模板名称 | String |
BucketId | Response.Template | 模板所属存储桶 | String |
Category | Response.Template | 模板属性,Custom 或者 Official | String |
Tag | Response.Template | 模板类型,Tts | String |
UpdateTime | Response.Template | 更新时间 | String |
CreateTime | Response.Template | 创建时间 | String |
Tts | Response.Template | 详细的模板参数 | Container |
该请求操作无特殊错误信息,常见的错误信息请参见 错误码 文档。
POST /template HTTP/1.1
Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0e****
Host: examplebucket-1250000000.ci.ap-beijing.myqcloud.com
Content-Length: 1666
Content-Type: application/xml
<Request>
<Tag>Tts</Tag>
<Name>TemplateName</Name>
<Mode>Sync</Mode>
<Codec>pcm</Codec>
<VoiceType>ruxue</VoiceType>
<Volume>2</Volume>
<Speed>200</Speed>
</Request>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 100
Connection: keep-alive
Date: Thu, 15 Jun 2017 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****
<Response>
<Template>
<Tag>Tts</Tag>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Name>TemplateName</Name>
<TtsTpl>
<Mode>Sync</Mode>
<Codec>pcm</Codec>
<VoiceType>ruxue</VoiceType>
<Volume>2</Volume>
<Speed>200</Speed>
</TtsTpl>
<CreateTime>2020-08-05T11:35:24+0800</CreateTime>
<UpdateTime>2020-08-31T16:15:20+0800</UpdateTime>
</Template>
</Response>
本页内容是否解决了您的问题?