Best Practices (Bulbul:v4-flash)
This guide covers model="bulbul:v4-flash" with persona speaker IDs in the form voice_language_style. For bulbul:v3 (short speaker names such as shubh and priya), see Bulbul v3 best practices.
Hear the personas before you ship: Voices lists every v4 Flash persona with audio samples.
What is Bulbul v4 Flash?
Flash is the interactive tier of the v4 family, built for voice agents, IVR and other cases where a listener is waiting. It is served over three transports (HTTP streaming, REST and WebSocket) with the same request contract.
Choosing the right endpoint
The default sample rate on every endpoint is 22050.
If a person is waiting for the first word, use HTTP streaming or WebSocket. REST returns only after the full clip is generated. Reuse HTTP connections (keep-alive or a pooled client) so each call does not pay DNS, TCP and TLS again.
See also Which API to Use.
Quick start
Set your key once:
HTTP streaming
REST
WebSocket
The response is JSON. Decode the base64 in audios[0] before writing to disk. The SDK’s save helper does this for you.
Connect once, then send config, text and flush per utterance. Setting send_completion_event=True makes the server send a final event when the last chunk is out.
Raw protocol: connect to wss://api.sarvam.ai/text-to-speech/ws?model=bulbul:v4-flash with the api-subscription-key header, then send these frames in order per utterance.
Audio arrives as {"type":"audio"} messages with base64 in data.audio. Keep the socket open across utterances and send {"type":"ping"} on idle connections. model is a URL query parameter, not a config field.
Parameter reference (v4 Flash)
Out-of-range values return 400, so validate in your client. Unknown request fields are silently ignored, so a misspelled parameter name has no effect.
Tuning guidance
Start at the defaults, change one setting at a time and listen.
Writing text for natural speech
Input formatting affects quality more than parameter tweaks.
Write each language in its own script
Romanised Indic input degrades quality. Write Indic words in native script and English words in Latin script, as a bilingual reader would.
For copy that is genuinely mixed English and Hindi, use the _enhi_ personas (simran_enhi_customer, ishita_enhi_customer, shubh_enhi_banking). Set language_code to the language whose number and entity conventions you want in speech.
Punctuation controls pauses
Keep sentences short. Very long sentences sound unnatural, and v4 Flash does not support SSML.
Numbers, dates and currency
Set enable_preprocessing=True and write numbers, dates and currency the way they appear in print. Standard digit grouping such as 10,000 or 5,00,000 is fine.
Names, brands and acronyms
Use a pronunciation dictionary instead of respelling words in your text.
Chunk on sentence boundaries
Split long or LLM-generated text at sentence boundaries. A split mid-sentence breaks intonation and is audible as a seam. Buffer LLM tokens until you have a full sentence, then synthesise it. Stay under the per-request limit for your endpoint (see Choosing the right endpoint).
Writing the raw base64 string from a REST response to a file produces corrupted audio. Decode first, or use the SDK’s save helper.
Speaker ID format
Every v4 Flash ID follows voice_language_style.
The same voice can appear under several styles (ritu_hi_customer and ritu_hi_reels) with different energy. Switching style is often better than switching voice. Personas are not equally strong in all languages, so audition cross-language use before production.
Recommended voices by use case
Expert picks for English (en-IN) and Hindi (hi-IN). Rank 1 is the default; ranks 2–3 are A/B candidates. Browse the full roster on Voices. The style segment (customer, recovery, sales) is a useful guide when your use case is not listed.
English (en-IN)
Hindi (hi-IN)
Roster coverage by language
Output formats and sample rates
Pick the codec by destination, then the lowest sample rate your pipeline plays.
Starting points: agents use wav at 16 kHz, telephony uses wav (or mulaw) at 8 kHz. Do not request 48 kHz if a gateway downsamples to 8 kHz; you only add transfer time.
Handling errors
On WebSocket, an error usually arrives as {"type":"error"} followed by a close. Reconnect before retrying. Log the request_id from responses when you contact support.
Key considerations
- Text limits are per request (REST 2,500 characters, HTTP streaming 3,500) or per message (WebSocket 2,500). Chunk at sentence boundaries.
- v4 Flash does not support SSML. Use
pace,pitch,loudness, punctuation and chunking for rhythm. - Always pass
speakerexplicitly so a default change never alters your voice. - WebSocket connections close after prolonged inactivity. Send
pingbefore that window.
Migrating from Bulbul v3
v4 Flash uses the same endpoints, authentication and request shape as bulbul:v3. Migrating usually means changing model and speaker.
What changes
What stays the same
- Endpoints,
api-subscription-keyheader, base64audiosresponse and theconfig,text,flushWebSocket sequence. pace,pitch,loudness,temperature,enable_preprocessinganddict_id, with the same ranges.- Sample rates, codecs and text limits.
Before and after
Python
WebSocket
Mapping v3 speakers to v4 personas
Each v3 voice has one or more v4 Flash personas. The table gives the closest starting persona, matching the voice’s v4 display name in Speakers & voice. Voices with several personas (Shubh, Ritu, Simran, Ishita, Ratan) often have a better-fitting style for your use case. Browse them on Voices.
The same name doesn’t guarantee an identical sound. v4 personas are re-recorded per style, so audition the new persona with your own production copy before you switch.
Rollout checklist
- Find every call site. Search for
bulbul:v3and for calls that omitmodel(they default to v3). - Swap
modelandspeakerusing the table above. - Audition Malayalam (
ml-IN) and Odia (od-IN) on v4 Flash before moving them, since there are no dedicated personas. - Write Indic words in native script and English in Latin script (see Writing text for natural speech).
- A/B on real traffic: route a slice to v4 Flash and compare listener feedback and pronunciation of names and numbers.
- Keep v3 as a fallback. Both models share a request shape, so rolling back means changing
modelandspeakeragain.
Need bulbul:v3 short-name speakers? See Bulbul v3 best practices.