Skip to navigation

Best Practices (Bulbul:v4-flash)

View as Markdown

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.

I want to…Go to
Make my first callQuick start
Choose REST, HTTP stream or WebSocketChoosing the right endpoint
See every parameter and rangeParameter reference
Fix mispronunciations and awkward pausesWriting text for natural speech
Pick a voiceRecommended voices by use case
Move from bulbul:v3Migrating from Bulbul v3

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.

CapabilityDetail
Languages11 codes: hi-IN, bn-IN, ta-IN, te-IN, gu-IN, kn-IN, ml-IN, mr-IN, pa-IN, od-IN, en-IN. en-US is not accepted; use en-IN.
Code-mixingHinglish, Tanglish and similar mixes, with each language written in its own script.
Prosodypace, pitch, loudness and temperature.
Preprocessingenable_preprocessing normalises numbers, dates, currency and mixed-script text before synthesis (default false).
PronunciationPronunciation dictionaries via dict_id.
Codecswav, mp3, aac, flac, linear16, mulaw, alaw, opus.
Voices224 persona IDs live today (see roster coverage).

Choosing the right endpoint

HTTP streamingRESTWebSocket
PathPOST /text-to-speech/streamPOST /text-to-speechwss://api.sarvam.ai/text-to-speech/ws
ReturnsChunked audio bytesJSON: {"request_id", "audios": [base64]}{"type":"audio"} messages with base64 chunks
Text limit3,500 characters2,500 characters2,500 characters per message
Sample rates8000, 16000, 22050, 240008000, 16000, 22050, 24000, 32000, 44100, 480008000, 16000, 22050, 24000
Default codecmp3wavmp3
Playable before completionYesNoYes
Best forVoice agents, IVR, LLM read-aloudOffline files, 32 / 44.1 / 48 kHz outputMany utterances on one connection

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:

export SARVAM_API_KEY="your-key"
import os
from sarvamai import SarvamAI
client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])
with open("output.wav", "wb") as f:
for chunk in client.text_to_speech.convert_stream(
text="नमस्ते! आपका order 2 दिन में deliver हो जाएगा।",
language_code="hi-IN",
model="bulbul:v4-flash",
speaker="aparna_hi_customer",
speech_sample_rate=24000,
output_audio_codec="wav",
enable_preprocessing=True,
):
f.write(chunk)

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.

FieldValuesNotes
textstringRequired.
language_codehi-IN, bn-IN, ta-IN, te-IN, gu-IN, kn-IN, ml-IN, mr-IN, pa-IN, od-IN, en-INRequired on REST and HTTP streaming. Also drives number, date and entity reading rules.
modelbulbul:v4-flashOmitting it routes to bulbul:v3.
speakerPersona ID, e.g. ritu_hi_customerUnknown values return 400 with the valid list. Default if omitted: shubh_enhi_ads.
speech_sample_rate8000, 16000, 22050, 24000 (plus 32000, 44100, 48000 on REST)Default 22050.
output_audio_codecwav, mp3, aac, flac, linear16, mulaw, alaw, opusOn REST, opus needs 8000, 16000, 24000 or 48000.
output_audio_bitrate32k to 192kDocumented for MP3 on HTTP streaming.
pace0.5 to 2.0, default 1.0Speaking rate.
pitch-0.5 to 0.5, default 0.0Shifts pitch while preserving the voice’s identity.
loudness0.1 to 2.5, default 1.0Output gain. Prefer it over downstream amplification.
temperature0.01 to 1.0, default 0.6Expressiveness.
enable_preprocessingboolean, default falseNormalises numbers, dates and mixed script.
dict_idp_ plus 8 hex charactersPronunciation dictionary.

Tuning guidance

Start at the defaults, change one setting at a time and listen.

SettingWhere it helps
pace 0.8 to 0.9EdTech, wellness, accessibility, instructional content
pace 1.0Conversational agents (start here)
pace 1.1 to 1.2Notifications, news, professional IVR
pitch ±0.1 to 0.2Small brand-tone tweaks; audition larger shifts
loudness 1.0Keep the default unless matching a fixed telephony level
import os
from sarvamai import SarvamAI
client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])
audio = client.text_to_speech.convert(
text="आपका payment कल तक पूरा हो जाएगा।",
language_code="hi-IN",
model="bulbul:v4-flash",
speaker="shubh_en_recovery",
pace=1.1, # slightly brisk for a payment reminder
pitch=0.0, # keep the voice's identity
loudness=1.0, # match the platform, not the app
)

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.

LanguageUseAvoid
Hindiआपका order confirm हो गया हैAapka order confirm ho gaya hai
Tamilஉங்கள் order deliver ஆகிவிடும்Unga order deliver aayidum

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

PunctuationEffect
,Short pause
. or ।Sentence end (use । after Indic script)
!Emphasis and pause
…Hesitation; use sparingly, it can sound choppy
Line breakPause between paragraphs

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.

audio = client.text_to_speech.convert(
text="आपका bill ₹5,00,000 है, due date 15/03/2026 है।",
language_code="hi-IN",
model="bulbul:v4-flash",
speaker="shubh_enhi_banking",
enable_preprocessing=True,
)

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).

import re
def sentences(text):
# Split after ., !, ? or the Indic danda, keeping the punctuation.
return [s.strip() for s in re.split(r"(?<=[.!?।])\s+", text) if s.strip()]
with open("output.wav", "wb") as f:
for sentence in sentences(llm_output):
for chunk in client.text_to_speech.convert_stream(
text=sentence,
language_code="hi-IN",
model="bulbul:v4-flash",
speaker="aparna_hi_customer",
output_audio_codec="wav",
):
f.write(chunk)

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.

IDMeaning
ritu_hi_customerRitu, Hindi, customer care
shubh_en_recoveryShubh, English, recovery
simran_enhi_customerSimran, English and Hindi code-mixed, customer care

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.


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)

Use caseFemaleMale
Sales / lead conversion1. simran_en_sales · 2. aparna_hi_customer1. sunny_en_social · 2. rohan_en_recovery · 3. shubh_hi_ecomm
Collections / payment reminder1. aparna_hi_kyc · 2. sanchita_en_recovery · 3. zarina_en_conversation1. shubh_en_recovery · 2. shubh_hi_ecomm
Customer care & empathetic support1. aparna_en_companion · 2. sanchita_en_companion1. shubh_hi_customer
Appointments / receptionist1. aparna_hi_customer · 2. sanchita_en_insuranceNone
EdTech / tutor1. aparna_en_edtechNone

Hindi (hi-IN)

Use caseFemaleMale
Sales / lead conversion1. aparna_hi_customer1. shubh_hi_customer
Collections / payment reminder1. simran_hi_recovery1. shubh_hi_ecomm · 2. shubh_hi_customer
Customer care & empathetic support1. aparna_hi_customer · 2. aarti_hi_customerNone
Appointments / receptionist1. aparna_hi_customer1. shubh_hi_ecomm · 2. ratan_hi_customer_expressive

Roster coverage by language

LanguageVoicesSpeaker IDsNotes
Hindi hi48116Deepest coverage
English en2962Indian accent plus a few other accents
English + Hindi enhi613Code-mixed copy
Marathi mr89
Kannada, Punjabi, Tamil, Telugu3 each4 eachNarrow; audition carefully
Bengali, Gujarati3 / 23 each
Malayalam, OdiaNoneNoneml-IN and od-IN are accepted codes, but v4 Flash has no dedicated ml or od personas


Output formats and sample rates

Pick the codec by destination, then the lowest sample rate your pipeline plays.

CodecBest for
wavAgents, post-processing, archival (uncompressed)
mp3Web, mobile, distribution
aaciOS, adaptive streaming
flacLossless archival, smaller than WAV
linear16Raw PCM buffers in real-time agents
mulaw, alawPSTN and telephony gateways
opusCompressed real-time audio (on REST: 8000, 16000, 24000 or 48000 Hz only)
RateEndpointsUse case
8 kHzAllTelephony, IVR, PSTN legs
16 kHzAllVoice agents
22.05 kHzAllGeneral playback (default)
24 kHzAllHighest rate on streaming endpoints
32 / 44.1 / 48 kHzREST onlyBroadcast, podcast, offline

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

StatusMeaningAction
200SuccessNone
400Bad speaker, language, parameter range or dict_idFix the request; the message lists valid speakers
403Missing or invalid API keyCheck the api-subscription-key header
429ThrottledRetry with exponential backoff and jitter

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.

import os
import time
from sarvamai import SarvamAI
from sarvamai.core.api_error import ApiError
client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"])
for attempt in range(4):
try:
audio = client.text_to_speech.convert(
text="Hello from Sarvam AI!",
language_code="en-IN",
model="bulbul:v4-flash",
speaker="simran_en_customer",
)
break
except ApiError as e:
if e.status_code == 429 and attempt < 3:
time.sleep(2 ** attempt) # exponential backoff
continue
raise

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 speaker explicitly so a default change never alters your voice.
  • WebSocket connections close after prolonged inactivity. Send ping before 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

bulbul:v3bulbul:v4-flashAction
modelbulbul:v3 (also the default when omitted)bulbul:v4-flashSet explicitly.
speakerShort names: shubh, priya, rituPersona IDs: ritu_hi_customerRequired change. Each model rejects the other’s names with 400.
Default speakershubhshubh_enhi_adsAlways pass speaker.
Languages11 codes11 codes; dedicated personas for 9 (none for ml-IN, od-IN)Audition Malayalam and Odia before moving them.
WebSocket?model=bulbul:v3?model=bulbul:v4-flashmodel is a URL query parameter.

What stays the same

  • Endpoints, api-subscription-key header, base64 audios response and the config, text, flush WebSocket sequence.
  • pace, pitch, loudness, temperature, enable_preprocessing and dict_id, with the same ranges.
  • Sample rates, codecs and text limits.

Before and after

# Before: Bulbul v3
audio = client.text_to_speech.convert(
text="नमस्ते! आपका order 2 दिन में deliver हो जाएगा।",
model="bulbul:v3",
language_code="hi-IN",
speaker="ritu",
)
# After: Bulbul v4 Flash
audio = client.text_to_speech.convert(
text="नमस्ते! आपका order 2 दिन में deliver हो जाएगा।",
model="bulbul:v4-flash",
language_code="hi-IN",
speaker="ritu_hi_customer",
)

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.

v3 speakerStart withOther personas
shubhshubh_enhi_adsshubh_hi_customer, shubh_hi_ecomm, shubh_en_recovery, …
rituritu_hi_customerritu_hi_sales, ritu_hi_banking, ritu_hi_customer_warm, …
simransimran_enhi_customersimran_en_customer, simran_en_sales, simran_hi_recovery, …
ishitaishita_enhi_customerishita_hi_banking, ishita_hi_edtech, …
priyapriya_hi_recoveryNone
rohanrohan_en_recoveryNone
devdev_en_recoverydev_en_conversational
sunnysunny_enhi_customersunny_en_social, sunny_hi_ads, sunny_hi_reels
ratanratan_hi_latenightratan_hi_customer_expressive, ratan_hi_documentary, …
anandanand_hi_newsanand_hi_documentary, anand_pa_customer, …
rooparoopa_hi_narrationroopa_hi_companion, roopa_hi_recovery, …
varunvarun_en_suspensevarun_en_ads
poojapooja_gu_conversationalpooja_gu_customer, pooja_te_conversation
nehaneha_en_customerneha_en_latenight, neha_mr_narration
taruntarun_hi_conversationaltarun_hi_sales, tarun_te_narration
adityaaditya_hi_conversationaladitya_hi_sales
shreyashreya_hi_conversationalshreya_hi_news
manimani_hi_conversationalmani_hi_devotional
kavithakavitha_te_narrationkavitha_te_conversation
rahul, kavya, amit, manan, sumit, kabir, aayan, ashutosh, mohit<name>_hi_conversationalNone
shrutishruti_hi_edtechNone
suhani / rehansuhani_hi_social / rehan_hi_socialNone
advaitadvait_hi_characterNone
tanyatanya_hi_narrationNone
gokul / vijaygokul_ta_narration / vijay_ta_narrationNone
sohamsoham_mr_narrationNone

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

  1. Find every call site. Search for bulbul:v3 and for calls that omit model (they default to v3).
  2. Swap model and speaker using the table above.
  3. Audition Malayalam (ml-IN) and Odia (od-IN) on v4 Flash before moving them, since there are no dedicated personas.
  4. Write Indic words in native script and English in Latin script (see Writing text for natural speech).
  5. A/B on real traffic: route a slice to v4 Flash and compare listener feedback and pronunciation of names and numbers.
  6. Keep v3 as a fallback. Both models share a request shape, so rolling back means changing model and speaker again.

Need bulbul:v3 short-name speakers? See Bulbul v3 best practices.