Turn it on
Setaudio_config in the request: container for the format, sample_rate, and bitrate for MP3. This example asks for a 24 kHz MP3:
Examples
The same Hindi sentence (Timbre v3.0, voice Shivani) in each format. The sample rate and size are from the returned files.
Two things the files show: µ-law and A-law came back at 8 kHz although 48 kHz was asked for, as documented; and the 32 kbps MP3 came back at 22.05 kHz although 24 kHz was asked for. See Things to watch for.
By interface
- REST
- Streaming (SSE)
- Realtime (WebSocket)
POST /api/v1/tts/inference returns the whole audio as the response body, with the Content-Type of the format (table below). Save it as a file.By model
Timbre v3.0 and Timbre v2.5 offer the same formats and sample rates. Voice cloning lists WAV, raw PCM, MP3, OGG Opus and µ-law, at 8,000 to 44,100 Hz.Rules and limits
sample_rate:8000,16000,22050,24000,44100or48000. Default48000.- Other fields:
num_channels(default1) andsample_widthin bytes (default2).encodingis not needed formp3. - Equivalent settings:
container: "raw"withencoding: "pcm_mulaw"is the same ascontainer: "mulaw"; withpcm_alaw, the same asalaw;encoding: "oggopus"withraworoggis the same ascontainer: "ogg".
Things to watch for
- A low MP3 bitrate lowers the sample rate. With
bitrate: "32k", requests for 24,000 and 48,000 Hz both returned 22,050 Hz files; 16,000 Hz was kept, and 24,000 Hz was kept at128k. Read the sample rate from the file, not from your request. Other bitrates: TBC. - µ-law and A-law are always 8 kHz and have no header. Most telephony platforms expect exactly this; to play one on a computer, decode it or wrap it in a WAV header first.
rawhas no header either. Keep thesample_rateyou asked for: a player needs it to play the audio at the right speed.- OGG Opus plays at 48 kHz. The file records the rate you asked for, but Opus players decode at 48 kHz. This is normal for Opus.
- Higher is not always better. A narrowband phone line carries 8 kHz audio however high the rate you request; ask for what the destination plays.
- Python SDK:
AudioConfigdefaults to a 48 kHz WAV. The SDK checkscontainer,sample_rateandbitratebefore sending.
Related
Phone audio (Speech-to-Text)
The other side of the call: transcribing 8 kHz audio.
Streaming (SSE)
Start playback before the whole audio is ready.
Text-to-Speech (REST)
Every request field, with a request builder.
Limits
Text length, formats and rate limits.

