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
| Direction | L16 at 8 kHz | L16 at 16 kHz | L16 at 24 kHz | μ-law at 8 kHz |
|---|---|---|---|---|
| Inbound: Vobiz to your application | Supported | Supported | Not supported | Supported |
| Outbound: your application to Vobiz | Supported | Supported | Supported | Supported |
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.
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.
| Inbound format | XML contentType | REST content_type |
|---|---|---|
| L16 at 8 kHz | audio/x-l16;rate=8000 | audio/x-l16;rate=8000 |
| L16 at 16 kHz | audio/x-l16;rate=16000 | audio/x-l16;rate=16000 |
| μ-law at 8 kHz | audio/x-mulaw;rate=8000 | audio/x-mulaw;rate=8000 |
start.mediaFormat:
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
Setbidirectional="true" on <Stream>, then send a playAudio event. The event must describe the actual encoding and sample rate of its payload.
- L16 at 8 kHz
- L16 at 16 kHz
- L16 at 24 kHz
- μ-law at 8 kHz
Prepare the payload
Before you Base64 encode audio forplayAudio:
- 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.
| Format | Raw payload for 20 ms |
|---|---|
| μ-law at 8 kHz | 160 bytes |
| L16 at 8 kHz | 320 bytes |
| L16 at 16 kHz | 640 bytes |
| L16 at 24 kHz | 960 bytes |
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
| Symptom | Check |
|---|---|
| 24 kHz inbound stream does not connect | Use supported inbound L16 at 8 or 16 kHz. Configure 24 kHz only on outbound playAudio. |
| Audio is slow, fast, distorted, or silent | Confirm that the payload’s real encoding and rate match contentType and sampleRate. |
| A WAV or MP3 file does not play correctly | Remove the file-container header and send supported raw mono audio. |
Vobiz does not accept playAudio | Confirm that <Stream> uses bidirectional="true" and that you include the active streamId. |
| Your application decodes inbound audio incorrectly | Read start.mediaFormat for each WebSocket connection. |