TextToSpeechAsync
1. API Description
Domain name for API request: mps.intl.tencentcloudapi.com.
This API is used to convert text to speech asynchronously and supports long text to speech.
A maximum of 20 requests can be initiated per second for this API.
2. Input Parameters
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: TextToSpeechAsync. |
| Version | Yes | String | Common Params. The value used for this API: 2019-06-12. |
| Region | No | String | Common Params. This parameter is not required for this API. |
| Text | Yes | String | Text to convert to speech. |
| VoiceId | Yes | String | Voice ID. |
| TextLang | No | String | Text language. The default value is Chinese. |
| ExtParam | No | String | Extended parameters in the format of a JSON string. synExt (Object): Extended text to speech parameter. transExt (Object): Extended translation parameter. |
3. Output Parameters
| Parameter Name | Type | Description |
|---|---|---|
| ErrorCode | Integer | Error code. 0 is returned if the request is successful. |
| Msg | String | Error message. success is returned if the request is successful. |
| TaskId | String | Task ID. Use this ID to query the result. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
4. Example
Example1 Text to Speech Example
Input Example
POST / HTTP/1.1
Host: mps.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: TextToSpeechAsync
<Common request parameters>
{
"Text": "Hello",
"VoiceId": "s1_+DSBRZuGbfKlwsN1lV5OsriSYvOB3aSqqCsHH0LJ5BWHsmfmn13my4ki/QL+g+7RaRUWLhwPcEI6gtCTkA==",
"TextLang": "zh"
}
Output Example
{
"Response": {
"ErrorCode": 0,
"Msg": "success",
"TaskId": "1300057393-DubbingAsync-0d810bb0-d78b-4545-b36e-eab983b40a6a",
"RequestId": "0d810bb0-d78b-4545-b36e-eab983b40a6a"
}
}
Example2 Translation and Text to Speech Example
Input Example
POST / HTTP/1.1
Host: mps.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: TextToSpeechAsync
<Common request parameters>
{
"Text": "Hello",
"VoiceId": "s1_+DSBRZuGbfKlwsN1lV5OsriSYvOB3aSqqCsHH0LJ5BWHsmfmn13my4ki/QL+g+7RaRUWLhwPcEI6gtCTkA==",
"ExtParam": "{\n \"transExt\": {\n \"transInfo\": {\n \"transDst\": \"en\"\n },\n \"transRequirement\": \"Do not translate content inside quotation marks (including \\\"\\\" and “”) (keep Chinese as Chinese and English as English)\"\n }\n}"
}
Output Example
{
"Response": {
"ErrorCode": 0,
"Msg": "success",
"TaskId": "1300057393-DubbingAsync-fc3f52cf-f5f2-453c-882c-8847e5b2fe2f",
"RequestId": "fc3f52cf-f5f2-453c-882c-8847e5b2fe2f"
}
}
5. Developer Resources
SDK
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
- Tencent Cloud SDK 3.0 for Python
- Tencent Cloud SDK 3.0 for Java
- Tencent Cloud SDK 3.0 for PHP
- Tencent Cloud SDK 3.0 for Go
- Tencent Cloud SDK 3.0 for Node.js
- Tencent Cloud SDK 3.0 for .NET
- Tencent Cloud SDK 3.0 for C++
Command Line Interface
6. Error Code
There is no error code related to the API business logic. For other error codes, please see Common Error Codes.