- ssml
- guide
- tts
- speech-synthesis
- tutorial
- developers
SSML (Speech Synthesis Markup Language) is the standard way to control how text-to-speech engines pronounce and deliver your content. Instead of flat, robotic output, SSML gives you fine-grained control over:
Pronunciation— fix how specific words sound** Pacing**— speed up or slow down parts of your audio** Volume**— emphasize words or whisper them** Pitch**— raise or lower intonation** s**— add silence for dramatic effect** Breaths**— insert natural breathing sounds
This guide covers every major SSML tag with working examples. Most of these work with Google Cloud TTS, Azure Speech, Amazon Polly, and ElevenLabs.
Quick Start #
SSML wraps your text in <speak>
tags:
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis">
Hello, this is AI speech with SSML control.
</speak>
To use it with any major TTS API:
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
ssml = '<speak>Hello <break time="500ms"/> world.</speak>'
synthesis_input = texttospeech.SynthesisInput(ssml=ssml)
from elevenlabs import generate
audio = generate(text='<speak>Hello world.</speak>'), # ElevenLabs auto-detects SSML
Complete Tag Reference #
<break>
— s and Silence
The most commonly used SSML tag. Controls silence between words.
<speak>
No .
<break time="200ms"/> Short .
<break time="1s"/> One second .
<break strength="weak"/> Weak paragraph break.
<break strength="strong"/> Strong paragraph break.
<break strength="x-strong"/> Extra strong break.
</speak>
Strength values (approximate durations):
| strength | Typical |
|---|---|
| none | 0ms |
| x-weak | 250ms |
| weak | 500ms |
| medium | 750ms |
| strong | 1000ms |
| x-strong | 1500ms |
Pro tip: Use strength
when the exact timing doesn’t matter — the engine will choose a natural duration. Use time="500ms"
when you need precise, repeatable timing (e.g., for video synchronization).
<prosody>
— Pitch, Rate, and Volume
Controls the musical qualities of speech.
<speak>
<!-- Speech rate: slower and faster -->
<prosody rate="slow">This is slow speech.</prosody>
<prosody rate="x-slow">Very slow.</prosody>
<prosody rate="fast">This is fast speech.</prosody>
<prosody rate="x-fast">Very fast.</prosody>
<prosody rate="80%">80% of normal speed.</prosody>
<prosody rate="150%">50% faster.</prosody>
<!-- Pitch: higher and lower -->
<prosody pitch="low">This has low pitch.</prosody>
<prosody pitch="high">This has high pitch.</prosody>
<prosody pitch="-20%">20% lower pitch.</prosody>
<prosody pitch="+30%">30% higher pitch.</prosody>
<!-- Volume: quieter and louder -->
<prosody volume="silent">
<break time="1s"/>
</prosody>
<prosody volume="x-soft">Very quiet.</prosody>
<prosody volume="soft">Quiet speech.</prosody>
<prosody volume="medium">Normal volume.</prosody>
<prosody volume="loud">Loud speech.</prosody>
<prosody volume="x-loud">Very loud.</prosody>
<prosody volume="-6dB">6 decibels quieter.</prosody>
<!-- Combined: all three -->
<prosody rate="slow" pitch="+10%" volume="loud">
Combined attributes for dramatic narration.
</prosody>
</speak>
Real-world example — narration with natural pacing:
<speak>
<prosody rate="slow" pitch="low">
It was a dark and stormy night.
</prosody>
<break time="500ms"/>
<prosody rate="medium" volume="loud">
Suddenly, the door burst open!
</prosody>
<break time="300ms"/>
<prosody rate="x-fast" pitch="high">
She ran inside, breathless.
</prosody>
</speak>
<emphasis>
— Word-Level Stress
Marks words that should stand out.
<speak>
I <emphasis level="moderate">really</emphasis> mean it.
I <emphasis level="strong">absolutely</emphasis> mean it.
This is the <emphasis level="reduced">least important</emphasis> part.
</speak>
| Level | Effect |
|---|---|
| strong | Maximum emphasis, higher pitch and volume |
| moderate | Default, noticeable but natural |
| reduced | De-emphasized, lower and quieter |
| none | No emphasis |
<say-as>
— Interpret Text Correctly
Controls how numbers, dates, and abbreviations are pronounced.
<speak>
<!-- Numbers -->
<say-as interpret-as="cardinal">42</say-as> <!-- "forty-two" -->
<say-as interpret-as="ordinal">42</say-as> <!-- "forty-second" -->
<say-as interpret-as="digits">42</say-as> <!-- "four two" -->
<!-- Date formats -->
<say-as interpret-as="date" format="ymd">2026-07-24</say-as> <!-- "July 24th, 2026" -->
<say-as interpret-as="date" format="mdy">07/24/2026</say-as>
<say-as interpret-as="date" format="dmy">24/07/2026</say-as>
<!-- Characters -->
<say-as interpret-as="characters">HTML</say-as> <!-- "H T M L" -->
<say-as interpret-as="spell-out">AI</say-as> <!-- "A I" -->
<!-- Telephone numbers -->
<say-as interpret-as="telephone">555-0123</say-as>
<!-- Fractions -->
<say-as interpret-as="fraction">1/2</say-as> <!-- "one half" -->
<say-as interpret-as="fraction">3/4</say-as> <!-- "three quarters" -->
</speak>
<phoneme>
— Fix Pronunciation
The most powerful tag for accuracy. Uses IPA (International Phonetic Alphabet) to specify exact pronunciation.
<speak>
<!-- Fixing common mispronunciations -->
I enjoy eating <phoneme alphabet="ipa" ph="ˈtoʊ.mɑː.təʊ">tomato</phoneme>.
The <phoneme alphabet="ipa" ph="əˈskeɪ.dʒəs">esophagus</phoneme> connects the throat to the stomach.
The company <phoneme alphabet="ipa" ph="ˈliː.noʊ">Leno</phoneme> was founded in 2020.
<phoneme alphabet="ipa" ph="ˈniː.kɒn">Nikon</phoneme> cameras are excellent.
<!-- Using Google's x-sampa phonetic alphabet (alternative) -->
<phoneme alphabet="x-sampa" ph="'[email protected]">tomato</phoneme>
</speak>
Pro tip: Google’s Phoneme Visualizer is invaluable for finding correct IPA transcriptions. Also try ipa-reader to test pronunciations.
<audio>
— Insert Sound Effects
Available in Amazon Polly and some other providers. Inserts audio files or sound effects into speech.
<speak>
Welcome to our podcast!
<audio src="https://example.com/intro-music.mp3">
<break time="2s"/>
</audio>
Today we're discussing AI voice technology.
</speak>
The text inside <audio>
is used as fallback if the audio file can’t be loaded.
<p>
and <s>
— Paragraph and Sentence Boundaries
Explicitly marks structural units for better prosody.
<speak>
<p>
<s>This is the first sentence of the first paragraph.</s>
<s>This is the second sentence.</s>
</p>
<p>
<s>This is the first sentence of a new paragraph.</s>
</p>
</speak>
<sub>
— Substitution
Replace displayed text with different spoken text.
<speak>
The <sub alias="World Health Organization">WHO</sub> issued new guidelines.
We support <sub alias="Artificial Intelligence">AI</sub> research.
Open <sub alias="Monday through Friday">Mon-Fri</sub>.
</speak>
<lang>
— Language Switching
Switch between languages within a single SSML document.
<speak>
The French word <lang xml:lang="fr">bonjour</lang> means hello.
In Spanish, <lang xml:lang="es">gracias</lang> means thank you.
<lang xml:lang="de">Guten Morgen</lang> is German for good morning.
</speak>
<par>
and <media>
— Parallel Audio (Azure Only)
Azure Speech supports parallel audio streams.
<speak version="1.0" xmlns:mstts="http://www.w3.org/2001/mstts">
<par>
<media begin="0s">
<audio src="https://example.com/background.wav"/>
</media>
<media begin="0s">
Welcome to this presentation!
</media>
</par>
</speak>
Provider-Specific Tags #
Azure Speech — Expressiveness and Style
<speak version="1.0" xmlns:mstts="http://www.w3.org/2001/mstts"
xmlns:emo="http://www.w3.org/2009/10/emotionml">
<!-- Speaking style -->
<mstts:express-as style="cheerful">
Great news! Our project is going live.
</mstts:express-as>
<mstts:express-as style="sad">
We regret to inform you...
</mstts:express-as>
<mstts:express-as style="whisper" styledegree="1.5">
This is a secret message.
</mstts:express-as>
<!-- Available Azure styles: cheerful, sad, angry, fearful,
excited, friendly, hopeful, shouting, whispering,
terrified, unfriendly, whispering, cold, embarrassed -->
</speak>
ElevenLabs — SSML Support
ElevenLabs supports a subset of SSML including <break>
, <prosody>
, <phoneme>
, <say-as>
, and <emphasis>
. Their newer models handle SSML tags more naturally than older ones.
Real-World Examples #
Audiobook Narration
<speak>
<prosody rate="medium" pitch="-5%">
Chapter Three: The Discovery
</prosody>
<break time="1s"/>
<prosody rate="slow">
The morning sun <break time="200ms"/> cast long shadows across the room.
</prosody>
<prosody rate="medium" volume="loud" pitch="+10%">
"There you are!" <break time="150ms"/> she exclaimed.
</prosody>
<prosody rate="medium">
He turned slowly, <break time="300ms"/>
his face illuminated by the pale light.
</prosody>
</speak>
E-Learning Narration
<speak>
<prosody rate="medium">
Welcome to Module 4: <break time="200ms"/>
Machine Learning Fundamentals.
</prosody>
<break time="500ms"/>
<prosody rate="80%">
First, let's understand the key concept.
<break time="300ms"/>
Machine learning is a <emphasis level="strong">subset</emphasis>
of artificial intelligence that enables systems
to <say-as interpret-as="characters">AI</say-as> to learn from data.
</prosody>
<break time="400ms"/>
<prosody rate="90%">
Important: <break time="200ms"/>
<emphasis level="strong">Always validate your training data</emphasis>
before starting the model training process.
</prosody>
</speak>
YouTube Voice-Over
<speak>
<prosody rate="fast" pitch="+10%">
Hey everyone, welcome back to the channel!
<break time="400ms"/>
</prosody>
<prosody rate="medium">
Today we're reviewing the <sub alias="Text to Speech">TTS</sub>
landscape in 2026.
<break time="200ms"/>
There are <say-as interpret-as="cardinal">11</say-as>
major providers to choose from.
</prosody>
</speak>
Testing Your SSML #
Most providers offer SSML preview tools:
Google Cloud:Text-to-Speech SSML tester** Azure Speech:Audio Content Creation Studio Amazon Polly:AWS Console TTS tester ElevenLabs:**Paste SSML directly into theElevenLabs Speech Synthesis
Common Pitfalls #
| Mistake | Why | Fix |
|---|---|---|
| Missing namespace | SSML won’t parse | Always include xmlns="http://www.w3.org/2001/10/synthesis" |
| Self-closing breaks | <break/> may not work in all providers |
Always use <break time="500ms"/> with explicit attribute |
| Over-nesting | Some providers limit tag depth | Keep SSML flat — max 3-4 levels of nesting |
| Wrong phonetic alphabet | IPA works everywhere, x-sampa is Google-only | Stick to IPA (alphabet="ipa" ) for cross-provider compatibility |
| Forgetting encoding | Special characters break parsing | Use XML entities: & for &, < for <, > for > |
Compatibility Matrix #
| Tag | Google Cloud | Azure | Amazon Polly | ElevenLabs |
|---|---|---|---|---|
<break> |
✅ Full | ✅ Full | ✅ Full | ✅ Full |
<prosody> |
✅ Full | ✅ Full | ✅ Full | ✅ Partial |
<emphasis> |
✅ | ✅ | ✅ | ✅ |
<say-as> |
✅ | ✅ | ✅ | ✅ |
<phoneme> |
✅ IPA/x-sampa | ✅ IPA/SAPI | ✅ IPA/x-sampa | ✅ IPA |
<sub> |
✅ | ✅ | ✅ | ❌ |
<p> /<s> |
✅ | ✅ | ✅ | ❌ |
<lang> |
✅ | ✅ | ✅ | ❌ |
<audio> |
❌ | ✅ | ✅ | ❌ |
<par> /<media> |
❌ | ✅ | ❌ | ❌ |
mstts:express-as |
❌ | ✅ | ❌ | ❌ |
<voice> |
✅ | ❌ | ❌ | ❌ |
Bottom Line #
SSML is the difference between robotic speech and professional-quality AI voice output. Even basic tags — <break>
, <prosody>
, and <say-as>
— dramatically improve naturalness. For production content (audiobooks, e-learning, YouTube voice-overs), SSML is not optional — it’s the standard.
Related articles #
Try OfflineTTS #
Four local TTS engines, Whisper transcription, and private browser audio tools.