Skip to main content
Vobiz supports 8, 16, and 24 kHz audio across its WebSocket streaming flow. The supported rate depends on the audio direction. An inbound stream carries caller audio from Vobiz to your application. Outbound playback carries agent or TTS audio from your application to Vobiz. Configure each direction independently.

8 kHz

Use L16 or μ-law for inbound audio. Use L16 or μ-law for outbound playback.

16 kHz

Use L16 for inbound audio or outbound playback.

24 kHz

Use L16 for outbound playback only. Do not configure 24 kHz as the inbound Stream format.

Understand the two audio directions

To play 24 kHz TTS audio, set playAudio.media.sampleRate to 24000 and send genuine L16/24 kHz audio. Do not set <Stream contentType="audio/x-l16;rate=24000">. The Stream contentType controls inbound audio only.

Choose a sample rate

  • Use μ-law at 8 kHz when your telephony or agent integration already works with G.711 μ-law.
  • Use L16 at 8 kHz when your pipeline expects raw linear PCM at a telephony-oriented rate.
  • Use L16 at 16 kHz when your STT or TTS service expects 16 kHz linear PCM.
  • Use L16 at 24 kHz only for outbound playback when your TTS service produces genuine 24 kHz linear PCM.
Choose the rate that matches the next service in your pipeline. A higher declared rate does not convert or improve audio by itself.
A 24 kHz outbound payload does not guarantee 24 kHz audio at the handset. The carrier, SIP, or PSTN leg may use a lower-rate codec.

Configure inbound audio

Set the inbound format on the <Stream> element or the Audio Streams REST request. The following XML requests inbound L16/16 kHz audio and enables outbound playback:
When the WebSocket connects, Vobiz reports the selected inbound format in start.mediaFormat:
Save streamId for commands that you send to Vobiz. Decode every inbound media.payload using start.mediaFormat instead of assuming a rate in your application.

Send outbound audio

Set bidirectional="true" on <Stream>, then send a playAudio event. The event must describe the actual encoding and sample rate of its payload.
The inbound and outbound formats do not need to match. For example, your application can receive inbound L16/16 kHz audio and send outbound L16/24 kHz TTS audio on the same bidirectional WebSocket.

Prepare the payload

Before you Base64 encode audio for playAudio:
  • Use raw mono audio.
  • Remove WAV, MP3, and other file-container headers.
  • For L16, use signed 16-bit samples.
  • Generate or resample the audio at the rate declared in media.sampleRate.
  • Do not change only the JSON sample rate. That does not resample the payload.
Send outbound audio in approximately 20–60 ms chunks for responsive barge-in. This range is a recommendation, not a protocol requirement. After the final playAudio chunk for an utterance, send a checkpoint. Vobiz sends playedStream when playback reaches that checkpoint. Use clearAudio to discard queued playback when the caller interrupts.

Common configuration errors

Next steps