Live audio formats and sample rates
Describe the audio you send in the init body. The API reads your stream with these values: they must match it.
| field | values | default |
|---|---|---|
encoding |
wav/pcm (linear PCM), wav/alaw, wav/ulaw (G.711, telephony) |
wav/pcm |
bit_depth |
8, 16, 24, 32; wav/alaw and wav/ulaw are always 8-bit, whatever bit_depth says |
16 |
sample_rate |
8000, 16000, 32000, 44100, 48000 |
16000 |
channels |
1 to 8 |
1 |
Send the samples raw, without a WAV header: little-endian, channels interleaved. Phone audio goes as the line carries it, 8 kHz μ-law or A-law: see Transcribing phone calls.
{ "encoding": "wav/ulaw", "sample_rate": 8000, "bit_depth": 8, "channels": 2 }Sending the audio
Section titled “Sending the audio”- Binary frames (recommended): the bytes as they are.
- JSON:
{"type": "audio_chunk", "data": {"chunk": "<base64>"}}, a third larger.
Any chunk size works. 100 ms per chunk is a good default: smaller chunks add overhead, larger ones delay the transcripts. Send the audio as it is captured.
Several channels
Section titled “Several channels”A session takes up to 8 channels, 1 by default. The limit is the same for every account: it is not a setting.
Above it, POST /v2/live answers a 400 that says so, before any audio is sent: split the audio across
sessions of at most 8 channels each.
Each channel is transcribed on its own: utterances carry their channel (from 0), and utterance ids start with
it (01_00000004). Put each party of a call on its own channel to know who said what without
diarization, and with exact timing when they talk over each other: see
Multichannel and stereo call recordings.
Acknowledgments
Section titled “Acknowledgments”With receive_acknowledgments (on by default), the server acknowledges your audio once it is transcribed, with
audio_chunk messages whose byte_range counts the bytes since the start of the session. Keep the audio until it is
acknowledged to resend it after a network drop (Reconnections).
To get the acknowledgments on receipt instead, as Gladia’s cloud API sends them, set acknowledge_on_receipt: true
in the init body. The session then cannot resume: after a network drop, or a restart of the platform, it ends, and the audio
received but not transcribed yet is lost. Use it only when your client waits for acknowledgments before sending more audio and never
reconnects.