Parameters
For the full parameter list, see the API reference for Realtime STT (Auto) and Realtime STT (Manual).How each audio sample is stored, for example as 16-bit integers, 32-bit
floats, or compressed telephony audio.
The sample rate of the input audio in Hz, from 8,000 to 48,000. Must match the actual sample rate of
the audio you send.
Unlike the realtime endpoints, Batch STT also accepts containerized audio, such as
wav and mp3.For Batch STT, set encoding and sample_rate only when you upload raw audio. Realtime STT always requires both.Cheat sheet
As a rule of thumb, start with the row that matches your audio source:Telephony
North America and Japan
Many customers send their audio over Twilio. Twilio transcodes all audio it carries to µ-law encoding with an 8 kHz sample rate.Europe, India, and others
The standard for European and international telephone networks (G.711A) is 8-bit A-law compressed PCM with an 8 kHz sample rate.Voice agent platforms
Many voice agent platforms usepcm_s16le at a 16 kHz sample rate in their pipeline. Confirm what your platform uses.
Web browsers
When you capture microphone audio through the Web Audio API, the samples arepcm_f32le. That’s because an AudioContext, and the AudioWorklet nodes you read frames from, always produce 32-bit floats.
The capture sample rate defaults to whatever the user’s input hardware reports, commonly 48 kHz but sometimes 44.1 kHz. Read it from AudioContext.sampleRate and send the same value:
pcm_s16le at 16 kHz before you send cuts bandwidth with negligible impact on accuracy.
Double check your parameters
The model decodes your bytes using theencoding and sample_rate you declared in the connection. If these parameters are wrong, the server might not return an error.
To check them, save your audio data and play it back with ffplay:
encoding or sample_rate doesn’t match the data. The difference is usually obvious. Correct the values until your audio plays back cleanly, then send those same values to the API.