Mandala
Tools

Text-to-Speech

Convert text to speech using AI voices

TTS block configured with the Sanjaya provider, a Hindi voice and an emotion preset

Usage Instructions

Generate natural-sounding speech from text.

Sanjaya is Ayantram's own hosted speech service and the default provider. It needs no API key, speaks 600+ languages including every major Indian language, supports emotion presets, and can use a voice cloned for your organization. Usage is billed to your workspace at ₹15 per 10,000 characters (about $0.158), charged on the characters you submit.

The other providers — OpenAI, Deepgram, ElevenLabs, Cartesia, Google Cloud, Azure and PlayHT — are billed by those vendors to your own API key.

Language is the script you write

There is no language setting to get right. Write Devanagari and the voice speaks Hindi; write Latin and it speaks English; write Bengali and it speaks Bengali — all in the same voice, and all in one line if you mix them:

Hey, just do me a favor, मेरी बात सुनो, বাকি সব ঠিক হয়ে যাবে।

That renders as one continuous voice with no seams.

The accent travels with the voice, even though the language does not. An English-native voice handed Devanagari speaks Hindi with an English accent. Pick a voice whose accent matches the language your listener will hear most of — sanjaya:aarohi or sanjaya:nikhil for Hindi, and see the Voices list in Settings for the native voice in each language.

Numbers are spoken correctly by default

"Speak digits as words" is on by default and should stay on. The engine mis-reads bare digit runs in Indic scripts — डोलो 650 मिलीग्राम has been rendered as "105", "605" and "750" — so a dosage, price or OTP read from digits is a real-world error, not a cosmetic one. With the setting on, the number is spelled out before synthesis and read correctly.

The service also tells quantities from identifiers using context: कुल ₹320 is read as an amount, while आपका ओटीपी 4400 है is read digit by digit ("डबल चार डबल शून्य"), because a customer cannot type back "four thousand four hundred".

Tools

tts_sanjaya

Convert text to speech using Sanjaya, Ayantram's hosted multilingual service. No API key required.

Input

ParameterTypeRequiredDescription
textstringYesThe text to speak. The language is implicit in the script.
voiceIdstringNoA preset persona such as sanjaya:aarohi, or a voice cloned in Settings. Omit for the default voice.
emotionstringNoneutral, happy, cheerful, excited, calm, empathetic, serious, sad, angry or whisper. Works in every language. Omit to let the text choose a safe delivery.
emotionIntensitynumberNoStrength of the emotion, 0 to 2 (default 1)
outputFormatstringNowav (default), mp3, opus, flac, or ulaw/alaw for telephony
sampleRatenumberNo8000-24000 Hz. Telephony codecs are always 8000.
languagestringNoOptional hint, only needed to disambiguate a shared script (pass mr-IN for Marathi)
speednumberNoSpeaking-rate factor, 0.5 to 2
spellNumbersbooleanNoSpeak digits as words. On by default — see the warning above.
autoPausebooleanNoAdd micro-pauses between clauses. Off by default; suits narration, not live calls.

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberCharacters spoken, which is what was billed
formatstringAudio format actually returned
attributionstringLicence attribution for the voice used. Display it verbatim wherever the audio is surfaced.
estimatedCostnumberEstimated cost in USD for this synthesis

tts_openai

Convert text to speech using OpenAI TTS models

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesOpenAI API key
modelstringNoTTS model to use (tts-1, tts-1-hd, or gpt-4o-mini-tts)
voicestringNoVoice to use (alloy, ash, ballad, cedar, coral, echo, marin, sage, shimmer, verse)
responseFormatstringNoAudio format (mp3, opus, aac, flac, wav, pcm)
speednumberNoSpeech speed (0.25 to 4.0, default: 1.0)

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_deepgram

Convert text to speech using Deepgram Aura

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesDeepgram API key
modelstringNoDeepgram model/voice (e.g., aura-asteria-en, aura-luna-en)
voicestringNoVoice identifier (alternative to model param)
encodingstringNoAudio encoding (linear16, mp3, opus, aac, flac)
sampleRatenumberNoSample rate (8000, 16000, 24000, 48000)
bitRatenumberNoBit rate for compressed formats
containerstringNoContainer format (none, wav, ogg)

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_elevenlabs

Convert text to speech using ElevenLabs voices

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
voiceIdstringYesThe ID of the voice to use
apiKeystringYesElevenLabs API key
modelIdstringNoModel to use (e.g., eleven_monolingual_v1, eleven_turbo_v2_5, eleven_flash_v2_5)
stabilitynumberNoVoice stability (0.0 to 1.0, default: 0.5)
similarityBoostnumberNoSimilarity boost (0.0 to 1.0, default: 0.8)
stylenumberNoStyle exaggeration (0.0 to 1.0)
useSpeakerBoostbooleanNoUse speaker boost (default: true)

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_cartesia

Convert text to speech using Cartesia Sonic (ultra-low latency)

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesCartesia API key
modelIdstringNoModel ID (sonic-english, sonic-multilingual)
voicestringNoVoice ID or embedding
languagestringNoLanguage code (en, es, fr, de, it, pt, etc.)
outputFormatjsonNoOutput format configuration (container, encoding, sampleRate)
speednumberNoSpeed multiplier
emotionarrayNoEmotion tags for Sonic-3 (e.g., ['positivity:high'])

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_google

Convert text to speech using Google Cloud Text-to-Speech

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesGoogle Cloud API key
voiceIdstringNoVoice ID (e.g., en-US-Neural2-A, en-US-Wavenet-D)
languageCodestringYesLanguage code (e.g., en-US, es-ES, fr-FR)
genderstringNoVoice gender (MALE, FEMALE, NEUTRAL)
audioEncodingstringNoAudio encoding (LINEAR16, MP3, OGG_OPUS, MULAW, ALAW)
speakingRatenumberNoSpeaking rate (0.25 to 2.0, default: 1.0)
pitchnumberNoVoice pitch (-20.0 to 20.0, default: 0.0)
volumeGainDbnumberNoVolume gain in dB (-96.0 to 16.0)
sampleRateHertznumberNoSample rate in Hz
effectsProfileIdarrayNoEffects profile (e.g., ['headphone-class-device'])

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_azure

Convert text to speech using Azure Cognitive Services

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesAzure Speech Services API key
voiceIdstringNoVoice ID (e.g., en-US-JennyNeural, en-US-GuyNeural)
regionstringNoAzure region (e.g., eastus, westus, westeurope)
outputFormatstringNoOutput audio format
ratestringNoSpeaking rate (e.g., +10%, -20%, 1.5)
pitchstringNoVoice pitch (e.g., +5Hz, -2st, low)
stylestringNoSpeaking style (e.g., cheerful, sad, angry - neural voices only)
styleDegreenumberNoStyle intensity (0.01 to 2.0)
rolestringNoRole (e.g., Girl, Boy, YoungAdultFemale)

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

tts_playht

Convert text to speech using PlayHT (voice cloning)

Input

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech
apiKeystringYesPlayHT API key (AUTHORIZATION header)
userIdstringYesPlayHT user ID (X-USER-ID header)
voicestringNoVoice ID or manifest URL
qualitystringNoQuality level (draft, standard, premium)
outputFormatstringNoOutput format (mp3, wav, ogg, flac, mulaw)
speednumberNoSpeed multiplier (0.5 to 2.0)
temperaturenumberNoCreativity/randomness (0.0 to 2.0)
voiceGuidancenumberNoVoice stability (1.0 to 6.0)
textGuidancenumberNoText adherence (1.0 to 6.0)
sampleRatenumberNoSample rate (8000, 16000, 22050, 24000, 44100, 48000)

Output

ParameterTypeDescription
audioUrlstringURL to the generated audio file
audioFilefileGenerated audio file object
durationnumberAudio duration in seconds
characterCountnumberNumber of characters processed
formatstringAudio format
providerstringTTS provider used

Streaming speech

The block returns a finished audio file. For a live conversation — a voice-mode chat, or an agent whose reply should start being spoken before it is finished — use the streaming endpoint instead, which returns first audio in roughly half a second regardless of how long the rest of the sentence is.

POST /api/proxy/tts/sanjaya/stream accepts two request shapes:

One line, spoken and closed (Content-Type: application/json):

{ "text": "आपका ऑर्डर कन्फ़र्म हो गया है।", "voiceId": "sanjaya:aarohi" }

Text streamed in as it is produced (Content-Type: application/x-ndjson) — the shape to use when piping a model's tokens straight into speech. The first line configures the session; every line after it is either text or a control action:

{"voiceId": "sanjaya:aarohi"}
{"text": "Hello there, "}
{"text": "your order is confirmed."}
{"action": "end"}

The socket to the speech service is opened once for the whole reply rather than once per sentence, and each completed sentence is released for synthesis as soon as it lands — so audio keeps flowing while the model is still writing.

The response is raw 16-bit PCM, not a WAV file: a container needs a length in its header, which would mean buffering the whole clip and losing the latency the endpoint exists for. Read the format from the response headers rather than assuming it, because a telephony caller gets 8 kHz G.711 from the same endpoint:

HeaderMeaning
X-Sanjaya-Sample-RateSample rate to decode and play at
X-Sanjaya-Encodingpcm_s16le, g711_ulaw or g711_alaw
X-Sanjaya-ChannelsAlways 1
X-Sanjaya-Bits16 for PCM, 8 for G.711

Streamed speech is billed the same way, on the characters sent.

Choosing a voice

Every voice available to your workspace lives under Settings → Tools → Voices, on two shelves: Preset voices, the personas we ship and maintain, and Your voices, the ones your organization has cloned.

Each row has a play button, so you can hear a voice before you put it in front of customers. By default it speaks a standard sample line — but the box above the list takes your own line, and every voice then reads that instead. This is the useful version of an audition: whether a voice sounds pleasant reading a greeting we wrote tells you much less than whether it can say your product names, your customers' names, and your actual script without sounding wrong.

A sample line is capped at 300 characters, and an audition is a real synthesis — billed on characters exactly like a block's. Use a Text to Speech block for anything longer.

The Voices settings panel: Preset voices and Your voices tabs, a box for your own sample line, and a play button on every row

Cloned voices

A cloned voice is one your organization registers from a short recording of a real person. It is visible and usable only inside your own tenant, it appears under Your voices, and it can be removed at any time — which is also how consent is withdrawn.

Cloning a voice

An organization admin can add a voice in about a minute. 10-20 seconds of one person speaking is all it takes, and the cloned voice then speaks any language exactly the way a preset does.

Open Settings → Tools → Voices and choose Clone a Voice.

Record, or upload a file. Record now captures in the browser and is the better option — it is tuned for cloning rather than for a phone call (see below). Upload a file takes an existing recording if you already have clean audio of the speaker.

Read the passage aloud at a natural pace. A passage is provided in English or Hindi. Use it rather than talking freely: the reference sets the clone's accent and pace, not just its timbre, so a natural customer-facing passage produces a better voice than improvised speech.

Name the voice for where it will be used — "Support Agent (Priya)" beats "Voice 2" once there are a dozen of them. The description is optional.

Confirm you have the speaker's permission. This is required, and the confirmation is recorded against your account.

Add Voice, and wait a few seconds. The service synthesizes with the new voice and re-transcribes the result to prove the clone actually works, so an unusable recording is rejected here rather than failing later in a live workflow.

The Clone a Voice dialog: record or upload, a reference passage to read, name, and the consent confirmation

The new voice appears in the same list, tagged Organization, and is immediately selectable in the block's Voice field and by the tts_sanjaya agent tool.

Recording in the browser

The recorder is tuned for cloning rather than for a phone call, which is where most of the quality difference comes from:

  • Every voice-processing feature is switched off. Browsers enable echo cancellation, noise suppression and automatic gain control by default. All three are actively harmful here — gain control flattens the dynamics that make a voice recognisable, noise suppression carves holes straight through it, and echo cancellation can duck the speaker mid-sentence. The engine clones what it is given, so it would learn all three artifacts.
  • The audio is never compressed. Samples are captured straight off the audio graph and written as a 16-bit WAV, rather than the Opus the browser's own recorder produces. Opus thins exactly the top octave the cloning engine is most sensitive to.
  • A passage is provided to read, in English or Hindi. The reference sets the clone's accent and pace, not just its timbre, so reading a natural customer-facing passage produces a better voice than talking at random.

Before anything is uploaded, the clip is checked in the browser and you are told what is wrong with it:

CheckWhat happens
Shorter than 8s, or longer than 45sBlocked — record again
Distorted (too loud for the microphone)Blocked — nothing downstream can undo clipping
Very quietWarning — the clone copies the noise floor along with the voice
Mostly silenceWarning — less of the voice to learn from
Hissy / hot top endWarning — the measured predictor of a clone that clicks

These run before upload on purpose. Registration is slow — the service synthesizes with the new voice and re-transcribes the result to prove the clone works — so an unusable clip would otherwise cost a minute and a half to find out about.

A cloned voice is visible and usable only inside the organization that uploaded it. The built-in preset personas are shared by everyone.

Cloning a voice requires the speaker's permission, and the confirmation is recorded against the account that uploads the recording. Deleting the voice in Settings is the kill-switch: it stops the voice being usable and removes it from the speech service.

Adding a voice takes a few seconds because the new voice has to prove it can speak its own reference text before it is accepted — an unusable recording is rejected at upload rather than failing later in a live workflow.

Notes

  • Category: tools
  • Type: tts
Text-to-Speech