bland-hairdresser-72863
03/29/2026, 1:54 AMtall-airline-16756
03/29/2026, 1:55 AMtall-airline-16756
03/29/2026, 1:55 AMaudio_format = pcm (or the plugin’s default streaming format). This produces AudioFrame objects LiveKit expects and prevents “error decoding WAV audio.”
◦ Verify your TTS call returns audio frames rather than an encoded audio file blob.
1. If you need a WAV file (for storage or external processing)
◦ Collect the AudioFrame objects from the TTS stream.
◦ Combine frames and generate valid WAV bytes using the audio-frame helper:
from livekit import rtc
wav_bytes = rtc.combine_audio_frames(frames).to_wav_bytes()
• Pass wav_bytes to the component expecting a WAV byte stream.
1. If you must keep Sarvam producing MP3
◦ Decode the MP3 into PCM (audio frames) before sending into LiveKit.
◦ Use an MP3 decoder library to convert to PCM frames, then feed those frames into the LiveKit audio pipeline or convert them to WAV as needed.
Quick checks to confirm the root cause
• Is your Sarvam TTS call currently set to audio_format= "mp3"? If yes, switch it to pcm.
• What component emitted the “error decoding WAV audio”? Confirm it expects a full WAV byte stream (with header) and not raw PCM frames.
• If you can share a short log snippet of the TTS configuration or the code that receives Sarvam output, I can point to the exact place to change.
If you want, paste the TTS call/config or the small code path that receives the TTS output (no secrets). I’ll tell you the exact lines to change and a minimal example to produce PCM frames or a valid WAV output.
Sources: Rime TTS | LiveKit Documentation | Sarvam TTS plugin guide | LiveKit Documentation | Capturing the First Few Seconds of a Call for Processing, with interactive elements