API v1 method description

Generates speech from a text you provide.

Note

The API v1 does not support all the SpeechKit synthesis features. For a comparison of the API versions, see Synthesis features.

The synthesis service is available at tts.api.cloud.yandex.net/speech/v1/tts:synthesize.

Request body parameters

All parameters must be URL-encoded. The maximum size of a POST request body is 15 KB.

Parameter Description
text string
UTF-8 encoded text to convert to speech.
You can use only one of the fields: text or ssml.
To control pronunciation (pauses, emphasis, and stress), use the TTS markup.
The maximum string length is 5,000 characters.
ssml string
SSML text to convert to speech.
You can use only one of the fields: text or ssml.
lang string
Language.
Valid values: ru-RU (default), Russian.
voice string
Preferred speech synthesis voice from the list.
emotion string
Role or emotional tone of the voice. It is only supported for Russian (ru-RU). See List of voices for acceptable voice/emotional tone combinations.
speed string
The rate (speed) of synthesized speech.
The rate of speech is set as a decimal number in the range from 0.1 to 3.0. Where:
  • 3.0: Fastest rate.
  • 1.0 (default): Average human speech rate.
  • 0.1: Slowest speech rate.
format string
Synthesized audio format.
Acceptable values:
  • lpcm
  • oggopus (default)
  • mp3
sampleRateHertz string
Synthesized audio sampling frequency.
Used if format is set to lpcm. Valid values:
  • 48000 (default): 48 kHz.
  • 16000: 16 kHz.
  • 8000: 8 kHz.
folderId string

ID of the folder you have access to. Required for authorization with a user account (see Authentication with the SpeechKit API). Do not use this field if you make a request on behalf of a service account.

The maximum string length is 50 characters.

Response

If the synthesis was successful, the response will contain the audio file binary data. The output data format depends on the value of the format parameter.

For more on the response format and codes, see Response status codes.

Use cases

Folder: Space containing the Yandex Cloud resources. To authenticate to AI Studio, you need a folder ID. To get it, in the AI Studio interface, hover over the folder name at the top of the screen and click image. The ID will be copied to the clipboard.

image

Previous