简介
本文档提供关于人声分离模板接口的 API 概览和 SDK 示例代码。
新增人声分离模板
功能说明
用于新增人声分离模板。
方法原型
public Guzzle\\Service\\Resource\\Model createMediaVoiceSeparateTemplate(array $args = array());
请求示例
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的 region 可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为 http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {// https://cloud.tencent.com/document/product/436/58315 新增人声分离模板$result = $cosClient->createMediaVoiceSeparateTemplate(array('Bucket' => 'examplebucket-125000000', //存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket'Tag' => 'VoiceSeparate','Name' => 'VoiceSeparate-Template-Name','AudioMode' => 'IsAudio','AudioConfig' => array('Codec' => 'aac','Samplerate' => '','Bitrate' => '','Channels' => '',),));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数说明
Request 中的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 | 限制 |
Tag | Request | 模板类型: VoiceSeparate | String | 是 | 无 |
Name | Request | 模板名称 仅支持中文、英文、数字、_、-和* | String | 是 | 无 |
AudioMode | Request | 输出音频 | String | 是 | IsAudio:输出人声 IsBackground:输出背景声 AudioAndBackground:输出人声和背景声 |
AudioConfig | Request | 音频配置 | Container | 是 | 无 |
Container 类型 AudioConfig 的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 | 默认值 | 限制 |
Codec | Request.Audio | 编解码格式 | String | 否 | aac | 取值 aac、mp3、flac、amr |
Samplerate | Request.Audio | 采样率 | String | 否 | 44100 | 单位:Hz 可选 8000、11025、22050、32000、44100、48000、96000 当 Codec 设置为 aac/flac 时,不支持8000 当 Codec 设置为 mp3 时,不支持8000和96000 5. 当 Codec 设置为 amr 时,只支持8000 |
Bitrate | Request.Audio | 原始音频码率 | String | 否 | 无 | 单位:Kbps 值范围:[8,1000] |
Channels | Request.Audio | 声道数 | String | 否 | 无 | 当 Codec 设置为 aac/flac,支持1、2、4、5、6、8 2. 当 Codec 设置为 mp3,支持1、2 3. 当 Codec 设置为 amr,只支持1 |
返回结果示例
GuzzleHttp\\Command\\Result Object([Body] => GuzzleHttp\\Psr7\\Stream Object([stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #88[size:GuzzleHttp\\Psr7\\Stream:private] =>[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1[readable:GuzzleHttp\\Psr7\\Stream:private] => 1[writable:GuzzleHttp\\Psr7\\Stream:private] => 1[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array())[RequestId] => NjJhODcyMGVfNzgwYzAOIJDIOUJDIODJY=[ContentType] => application/xml[ContentLength] => 705[Bucket] => examplebucket-125000000[Location] => examplebucket-125000000.ci.ap-guangzhou.myqcloud.com/template[Response] => Array([RequestId] => NjJhODcyMGVfNzgwYzAOIJDIOUJDIODJY=[Template] => Array([TemplateId] => t13eedc8532b0644cas8d09as8d0338f[Name] => VoiceSeparate-Template-Name[State] => Normal[Tag] => VoiceSeparate[CreateTime] => 2022-06-14T19:33:34+0800[UpdateTime] => 2022-06-14T19:33:34+0800[BucketId] => examplebucket-125000000[Category] => Custom[VoiceSeparate] => Array([AudioMode] => IsAudio[AudioConfig] => Array([Codec] => aac[Samplerate] => 11025[Bitrate] => 300[Channels] => 2)))))
更新人声分离模板
功能说明
用于更新人声分离模板。
方法原型
public Guzzle\\Service\\Resource\\Model updateMediaVoiceSeparateTemplate(array $args = array());
请求示例
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的 region 可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为 http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {// https://cloud.tencent.com/document/product/436/58318 更新人声分离模板$result = $cosClient->updateMediaVoiceSeparateTemplate(array('Bucket' => 'examplebucket-125000000', //存储桶名称,由 BucketName-Appid 组成,可以在 COS 控制台查看 https://console.cloud.tencent.com/cos5/bucket'Key' => '', // TemplateId'Tag' => 'VoiceSeparate','Name' => 'VoiceSeparate-Template-Name','AudioMode' => 'IsAudio','AudioConfig' => array('Codec' => 'aac','Samplerate' => '','Bitrate' => '','Channels' => '',),));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数说明
Request 中的具体数据描述如下:
节点名称(关键字) | 父节点 | 描述 |
Tag | Request | 同人声分离模板 CreateMediaTemplate 接口中的 Request.Tag |
Name | Request | 同人声分离模板 CreateMediaTemplate 接口中的 Request.Name |
AudioMode | Request | 同人声分离模板 CreateMediaTemplate 接口中的 Request.AudioMode |
AudioConfig | Request | 同人声分离模板 CreateMediaTemplate 接口中的 Request.AudioConfig |
返回结果示例
GuzzleHttp\\Command\\Result Object([Body] => GuzzleHttp\\Psr7\\Stream Object([stream:GuzzleHttp\\Psr7\\Stream:private] => Resource id #88[size:GuzzleHttp\\Psr7\\Stream:private] =>[seekable:GuzzleHttp\\Psr7\\Stream:private] => 1[readable:GuzzleHttp\\Psr7\\Stream:private] => 1[writable:GuzzleHttp\\Psr7\\Stream:private] => 1[uri:GuzzleHttp\\Psr7\\Stream:private] => php://temp[customMetadata:GuzzleHttp\\Psr7\\Stream:private] => Array())[RequestId] => NjJhODczMDVfZmNjYTNiMGFJAOIDUJIOADJjNWU=[ContentType] => application/xml[ContentLength] => 707[Key] => t13eedc8532b0as8d09asd15338f[Bucket] => examplebucket-125000000[Location] => examplebucket-125000000.ci.ap-guangzhou.myqcloud.com/template/t13eedc8532b0as8d09asd15338f[Response] => Array([RequestId] => NjJhODczMDVfZmNjYTNiMGFJAOIDUJIOADJjNWU=[Template] => Array([TemplateId] => t13eedc8532b0as8d09asd15338f[Name] => VoiceSeparate-Template-Name[State] => Normal[Tag] => VoiceSeparate[CreateTime] => 2022-06-14T19:33:34+0800[UpdateTime] => 2022-06-14T19:37:41+0800[BucketId] => examplebucket-125000000[Category] => Custom[VoiceSeparate] => Array([AudioMode] => IsAudio[AudioConfig] => Array([Codec] => aac[Samplerate] => 11025[Bitrate] => 300[Channels] => 2)))))