Skip to main content

Text-to-Speech API

API Description

The text-to-speech synthesis API.

Request Description

URL

https://openapi.sys303.com/api/cognitive/tts/stream

Parameters

Header Parameters
ParameterValue
Content-Typeapplication/json
X-SecretGet it here
Body Parameters
ParameterRequiredTypePossible ValuesDescription
langYesint[0, 1, 4, 5]0: Tibetan (Ü-Tsang), 1: Chinese, 4: Tibetan (Khampa), 5: Tibetan (Amdo)
vcnNostring["xiaoxiao", "yunjian"]When lang is 1, optional; choose "xiaoxiao" or "yunjian". For other lang values, pass an empty string.
inputTextYesstring-Text for speech synthesis [Unicode, max 3000 characters]

Request Example

curl https://openapi.sys303.com/api/cognitive/tts/stream \
--request POST \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--header 'X-Secret: {X-Secret}' \
--data '{
"lang": 0,
"inputText": "Text for speech synthesis",
"vcn": ""
}' \
--output out.pcm

Return Explanation

Successful Request

Returns a PCM audio stream. Sample rate 16000; mono channel.

You can verify playback with:

ffplay -f s16le -ar 16000 out.pcm

Error Response Parameter Description

FieldRequiredTypeStatusDescription
traceIdYesString-Unique traceId for troubleshooting
msgIdYesString-Business status code
msgYesStringError description
dataYesString-Null

Return Example

Failure

Auth Failed:

{
"traceId": "0HNLN3J9DCJSE:00000001",
"msgId": "4011001",
"msg": "AuthFailed",
"data": null
}

Invalid request parameters:

{
"traceId": "0HNL06O44AU14:00000001",
"msgId": "500",
"msg": "Specified argument was out of the range of valid values. (Parameter 'lang')",
"data": null
}

Insufficient quota:

{
"traceId": "0HNL06O44AU1F:00000001",
"msgId": "2001001",
"msg": "InsufficientInventory",
"data": null
}

Input text too long:

{
"traceId": "0HNL06O44AUVB:00000001",
"msgId": "4004002",
"msg": "InputTooLong",
"data": null
}