Skip to navigation

Audio and Languages

View as Markdown

What audio Dictate accepts on each route, and which language codes you can send.

Audio limits

RouteLengthSize
Clip POST /v2/dictate30 s or lessUp to 10,000,000 bytes
Job POST /v2/dictate/jobsUp to 1 hourAbout 100 MB. Use audio_url for a larger file
Live socket GET /v2/dictate/wsA session of up to 3 hoursAt most 1 s of audio in each message

The gateway refuses a clip body over about 12 MB.

Audio formats

Send a file in any of these formats:

WAV, MP3, AAC, AIFF, OGG, Opus, FLAC, MP4/M4A, AMR, WMA and WebM.

Dictate finds the format from the MIME type or the file content, so you do not need to name it.

Bit depth, channels and sample rate do not matter. In testing, 8-bit, 24-bit, float32, stereo, 48 kHz, A-law and AU files all worked, on a clip and on a job.

Tips

Long job? Send compressed audio (MP3, M4A, Opus). It uploads faster.

Phone audio on the socket? Use 8 kHz: set sample_rate="8000", with mulaw or alaw.

Each form field other than file can be at most 1 MiB.

Languages

Send language_code with one of the 23 codes below. A known language is more reliable than auto.

LanguageCodeLanguageCode
Assameseas-INManipurimni-IN
Bengalibn-INMarathimr-IN
Bodobrx-INNepaline-IN
Dogridoi-INOdiaor-IN
English (India)en-INPunjabipa-IN
Gujaratigu-INSanskritsa-IN
Hindihi-INSantalisat-IN
Kannadakn-INSindhisd-IN
Kashmiriks-INTamilta-IN
Konkanikok-INTelugute-IN
Maithilimai-INUrduur-IN
Malayalamml-IN

Send auto to let Dictate detect the language. The language it found comes back in language_code.

Send the right code, as a form field. A code that does not match the audio is not an error: English audio sent as hi-IN comes back as English words written in Devanagari, with no warning. A language_code in the query string is ignored, so Dictate uses auto.

# Right: language_code is a form field
curl -sS https://api.sarvam.ai/v2/dictate \
-H "api-subscription-key: $SARVAM_API_KEY" \
-F file=@note.wav -F language_code=hi-IN
# Ignored: the query string. Dictate falls back to auto
curl -sS "https://api.sarvam.ai/v2/dictate?language_code=hi-IN" \
-H "api-subscription-key: $SARVAM_API_KEY" \
-F file=@note.wav

Outside Hindi, numbers as digits are best effort: some stay as words, and a converted value can be wrong. Check the text in the languages you ship.