语音合成模板

最近更新时间:2024-08-19 14:28:21

我的收藏

简介

本文档提供关于创建语音合成模板的相关 API 概览以及 SDK 示例代码。
API
操作描述
创建语音合成模板。
更新语音合成模板。

SDK API 参考

SDK 所有接口的具体参数与方法说明,请参考 SDK API

创建模板

功能说明

创建语音合成模板。
说明:
COS iOS SDK 版本需要大于等于 v6.2.9。

示例代码

Objective-C
QCloudPostVoiceSynthesisTempleteRequest * request = [QCloudPostVoiceSynthesisTempleteRequest new];
request.bucket = @"sample-1250000000";
request.regionName = @"COS_REGIONNAME";
request.input = [QCloudPostVoiceSynthesisTemplete new];
// 模板类型:Tts;是否必传:是
request.input.Tag = @"";
// 模板名称,仅支持中文、英文、数字、_、-和*,长度不超过 64;是否必传:是
request.input.Name = @"";

[request setFinishBlock:^(QCloudPostVoiceSynthesisTempleteResponse * outputObject, NSError *error) {
// result:QCloudPostVoiceSynthesisTempleteResponse 包含所有的响应;
// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84499
}];
[[QCloudCOSXMLService defaultCOSXML] PostVoiceSynthesisTemplete:request];

注意:
更多完整示例,请前往 GitHub 查看。
Swift
let request : QCloudPostVoiceSynthesisTempleteRequest = QCloudPostVoiceSynthesisTempleteRequest();
request.bucket = "sample-1250000000";
request.regionName = "COS_REGIONNAME";
let postVoiceSynthesisTemplete : QCloudPostVoiceSynthesisTemplete = QCloudPostVoiceSynthesisTemplete();
request.input = postVoiceSynthesisTemplete;
// 模板类型:Tts;是否必传:是
request.input.tag = "";
// 模板名称,仅支持中文、英文、数字、_、-和*,长度不超过 64;是否必传:是
request.input.name = "";

request.finishBlock = { result, error in
// result:QCloudPostVoiceSynthesisTempleteResponse 包含所有的响应;
// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84499
};
QCloudCOSXMLService.defaultCOSXML().postVoiceSynthesisTemplete(request);

注意:
更多完整示例,请前往 GitHub 查看。

更新模板

功能说明

更新语音合成模板。
说明:
COS iOS SDK 版本需要大于等于 v6.2.9。

示例代码

Objective-C
QCloudUpdateVoiceSynthesisTempleteRequest * request = [QCloudUpdateVoiceSynthesisTempleteRequest new];
request.bucket = @"sample-1250000000";
request.regionName = @"COS_REGIONNAME";
// 设置:TemplateId;
request.TemplateId = @"";
request.input = [QCloudUpdateVoiceSynthesisTemplete new];
// 模板类型:Tts;是否必传:是
request.input.Tag = @"";
// 模板名称,仅支持中文、英文、数字、_、-和*,长度不超过 64;是否必传:是
request.input.Name = @"";

[request setFinishBlock:^(QCloudUpdateVoiceSynthesisTempleteResponse * outputObject, NSError *error) {
// result:QCloudUpdateVoiceSynthesisTempleteResponse 包含所有的响应;
// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84758
}];
[[QCloudCOSXMLService defaultCOSXML] UpdateVoiceSynthesisTemplete:request];

注意:
更多完整示例,请前往 GitHub 查看。
Swift
let request : QCloudUpdateVoiceSynthesisTempleteRequest = QCloudUpdateVoiceSynthesisTempleteRequest();
// 设置:templateId;
request.templateId = null;
request.bucket = "sample-1250000000";
request.regionName = "COS_REGIONNAME";
let updateVoiceSynthesisTemplete : QCloudUpdateVoiceSynthesisTemplete = QCloudUpdateVoiceSynthesisTemplete();
request.input = updateVoiceSynthesisTemplete;
// 模板类型:Tts;是否必传:是
request.input.tag = "";
// 模板名称,仅支持中文、英文、数字、_、-和*,长度不超过 64;是否必传:是
request.input.name = "";

request.finishBlock = { result, error in
// result:QCloudUpdateVoiceSynthesisTempleteResponse 包含所有的响应;
// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84758
};
QCloudCOSXMLService.defaultCOSXML().updateVoiceSynthesisTemplete(request);

注意:
更多完整示例,请前往 GitHub 查看。