fix(sarvam-tts): correct mime_type from audio/mp3 to audio/wav#5086
Merged
davidzhao merged 1 commit intolivekit:mainfrom Mar 12, 2026
Merged
fix(sarvam-tts): correct mime_type from audio/mp3 to audio/wav#5086davidzhao merged 1 commit intolivekit:mainfrom
davidzhao merged 1 commit intolivekit:mainfrom
Conversation
The Sarvam TTS API returns WAV (RIFF) audio data, but the plugin declares mime_type="audio/mp3" in both ChunkedStream and SynthesizeStream. This causes the LiveKit audio decoder to attempt MP3 decoding on WAV data, resulting in: av.error.InvalidDataError: Invalid data found when processing input Confirmed by inspecting raw API responses — all Sarvam TTS endpoints (bulbul:v2, v3-beta, v3) return base64-encoded WAV with RIFF headers. This fix updates both emission points to use the correct mime_type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Sarvam TTS API returns WAV (RIFF) audio data, but the plugin declares
mime_type="audio/mp3"in bothChunkedStream(line 670) andSynthesizeStream(line 710). This causes the LiveKit audio decoder to attempt MP3 decoding on WAV data, resulting in:followed by:
This affects all Sarvam TTS models (
bulbul:v2,bulbul:v3-beta,bulbul:v3).Root cause
Verified by calling the Sarvam REST API directly and inspecting the raw response:
All models and sample rates (8000, 16000, 22050, 24000) return RIFF/WAV audio.
Fix
Change
mime_type="audio/mp3"→mime_type="audio/wav"in both:ChunkedStream._run()(HTTP batch path)SynthesizeStream._run()(WebSocket streaming path)Test plan
bulbul:v2(anushka, en-IN) — audio decodes correctlybulbul:v3(shubh, hi-IN) — audio decodes correctlybulbul:v3(ritu, en-IN) — audio decodes correctlybulbul:v3+ temperature=0.3 — audio decodes correctlybulbul:v3+ enable_preprocessing=True — audio decodes correctly