Audio format
Set the sample rate when you start the session. It must match your audio:
avatar.pushAudio(pcm, { sampleRate: 16000 }).
- Audio can arrive faster than real time. It’s queued and spoken at its natural pace, one chunk after another.
- Don’t send compressed audio. If your TTS only returns MP3, Opus or WAV, decode it to PCM first, and strip WAV headers.
- Don’t play the audio yourself. The avatar plays it.
Provider settings
OpenAI Realtime (WebSocket, server side)
OpenAI Realtime (WebSocket, server side)
Realtime audio deltas are base64 PCM16 at 24 kHz, so pass them straight through:If your page talks to OpenAI Realtime directly over WebRTC, the voice never reaches your server. Move the Realtime session to your server (WebSocket) to use Realistic Avatars, or use the Open Source avatar in the browser.
OpenAI TTS
OpenAI TTS
Ask for
response_format: "pcm": 24 kHz PCM16 mono. Stream the response body into pushAudio:ElevenLabs
ElevenLabs
Use
output_format: "pcm_24000" with sampleRate: 24000, or pcm_16000 with sampleRate: 16000.Azure Speech
Azure Speech
Use the output format
Raw24Khz16BitMonoPcm with sampleRate: 24000.Cartesia
Cartesia
Use
{ container: "raw", encoding: "pcm_s16le", sample_rate: 24000 } with sampleRate: 24000.Any other TTS
Any other TTS
Ask for raw 16-bit mono PCM at one of the supported sample rates, and pass that rate as
sampleRate.