Speech Synthesis Markup Language (SSML) allows you to fine-tune the output of a text-to-speech (TTS) engine. The W3C's SSML 1.1 Recommendation, published in 2010, remains the foundational standard for this process. By adding tags to your text, you can control the rhythm, timing, and emphasis of the generated audio. This guide explains how to use SSML prosody tags to make synthesized speech clearer and more natural.

Key takeaways

  • SSML is a request, not a command. A TTS engine interprets your markup as a suggestion. It may modify or ignore your tags based on the selected voice and its internal limits.
  • Use the right tag for the job. Use the <break> tag for pauses, <emphasis> for stress, and <prosody> for continuous attributes like speaking rate, pitch, and volume.
  • Implementations vary widely. The same SSML tag can produce different results across synthesis processors. It can even vary between different voices from the same provider. Always test your changes.
  • Start simple and tune iteratively. Avoid complex, nested tags at first. Make one change, listen to the output, and then make the next adjustment. Excessive markup often sounds unnatural.

How SSML Prosody Works: From Markup to Sound

SSML prosody works by adding a layer of instructions to plain text, which a text-to-speech engine uses to modify audio output. Your SSML tags are not direct audio commands but rather suggestions that influence how the final waveform is synthesized. This gives you control over the speech without needing to edit audio files directly.

SSML is an XML-based language designed to provide more control over synthesized speech (Source). The process works in a few steps:

  1. Parsing: You wrap your plain text in SSML tags. When a TTS service receives this input, its processor first parses the XML to separate the text to be spoken from the control tags like <prosody> or <break>.
  2. Parameter Mapping: The processor maps these tags to specific acoustic parameters. For example, a tag like <prosody rate="slow"> or <emphasis level="strong"> signals an intended change to the synthesizer. However, the standard leaves the acoustic realization to the processor, meaning it does not guarantee a specific numeric outcome.
  3. Synthesis: The synthesis engine uses these modified parameters to generate the final audio waveform. This method is known as parametric control: you are influencing the recipe for the sound, not editing the sound itself (Source).

Because SSML is a request to the synthesis processor, the final output depends on how that specific engine interprets your tags.

How do you control pauses and emphasis?

You can control pauses and emphasis using the <break> and <emphasis> tags. The <break> tag inserts a pause, specified either by a fixed time or a relative strength. The <emphasis> tag requests that a word or phrase be spoken with more prominence, letting the TTS engine decide how to apply the stress.

Pauses with <break>

The <break> tag inserts a pause or other prosodic boundary between words (Source). This is useful for separating ideas or creating a dramatic effect. Processors automatically infer breaks from linguistic context and punctuation, so you only need to use <break> for custom timing. The W3C specification makes explicit <break> tags optional between words for this reason.

There are two main ways to use it:

  • time: Specifies a pause of a precise duration, like 500ms for half a second or 2s for two seconds. This is best when you need exact timing.

    XML
    <speak>
      Processing complete. <break time="1s"/> Please check the results.
    </speak>
  • strength: Specifies a relative pause length. Values include none, x-weak, weak, medium, strong, and x-strong. A strong break is typically longer than a weak one. The default value is medium. These are more flexible, as they adapt to the overall speaking rate of the voice.

    XML
    <speak>
      First, enter your username. <break strength="medium"/> Then, enter your password.
    </speak>

Emphasis with <emphasis>

The <emphasis> tag tells the synthesizer to stress a word or phrase. You can set the level attribute to strong, moderate, none, or reduced.

Crucially, the SSML specification leaves the acoustic realization to the synthesizer (Source). One engine might add emphasis by altering pitch, while another might speak louder and slower. The effect varies across languages, dialects, and voices.

XML
<speak>
  You <emphasis level="strong">must</emphasis> complete this step.
</speak>

In this example, the word "must" will be spoken with more prominence than the surrounding words. Use this tag to draw attention to key information.

A Deeper Dive: The <prosody> Tag

The <prosody> tag gives you control over three key attributes of speech: the speaking rate, pitch, and volume. This tag can be wrapped around any amount of text, from a single word to an entire paragraph. It is one of the most powerful tools for fine-tuning TTS audio.

Speaking Rate

The rate attribute controls how fast the enclosed text is spoken. A slower rate can improve clarity. While different TTS engines may accept various values (such as named labels like slow or percentage changes), the W3C SSML 1.1 specification does not define a standard set of values for the rate attribute. The effect of any given value is processor-dependent.

XML
<speak>
  The standard rate.
  <prosody rate="slow">This is spoken more slowly for clarity.</prosody>
  And back to normal.
</speak>

Pitch

The pitch attribute alters the baseline pitch of the voice. As with rate, the specification does not standardize the values used to control pitch. Synthesizers may support relative changes or named labels, but the interpretation is implementation-specific.

XML
<speak>
  She said, <prosody pitch="high">"I can't believe it!"</prosody>
</speak>

Volume

The volume attribute adjusts the loudness of the speech. The SSML 1.1 standard identifies volume as a controllable dimension but does not define specific values for it. The interpretation of values like soft or loud is left to the synthesis processor.

XML
<speak>
  The main point is important.
  <prosody volume="soft">(This part is an aside.)</prosody>
</speak>

Worked Example: Progressively Tuning a Sentence

This example shows how to refine a sentence step-by-step using an iterative process. Starting with plain text, we will add a pause with <break>, apply stress with <emphasis>, and adjust speed with <prosody>. This workflow demonstrates how to transform a flat reading into a clear and intentional announcement.

Goal: Make the announcement "The launch is scheduled for Tuesday, not Wednesday" clear and impactful.

Step 1: Baseline (No SSML)

First, we send the plain text to the TTS engine.

<speak>The launch is scheduled for Tuesday, not Wednesday.</speak>

The default output will likely be flat, with a standard pause at the comma. It conveys the information but lacks intent.

Step 2: Add a Pause

To create a moment of anticipation and clearly separate the two conflicting pieces of information, we add a timed pause with <break>.

XML
<speak>
  The launch is scheduled for Tuesday<break time="400ms"/>, not Wednesday.
</speak>

This 400-millisecond pause makes the correction "not Wednesday" more distinct and noticeable.

Step 3: Add Emphasis

Next, we want to stress the correct day and de-emphasize the incorrect one. We use the <emphasis> tag for this.

XML
<speak>
  The launch is scheduled for <emphasis level="strong">Tuesday</emphasis><break time="400ms"/>, not Wednesday.
</speak>

By adding level="strong" to "Tuesday," we tell the engine to make it the most prominent word. The listener's attention is now drawn to the correct day.

Step 4: Adjust Rate and Final Polish

For final polish, we can slow down the most critical part of the sentence to ensure it is understood. We wrap the first clause in a <prosody> tag and use a slower rate. We can also de-emphasize "Wednesday" to make it even clearer that it's the incorrect option.

XML
<speak>
  <prosody rate="slow">The launch is scheduled for <emphasis level="strong">Tuesday</emphasis></prosody><break time="400ms"/>, not <emphasis level="reduced">Wednesday</emphasis>.
</speak>

Each change builds upon the last, layering prosodic meaning. The final result is a clear, intentional announcement that effectively communicates the intended message.

How Do You Choose the Right Value for Pitch, Rate, and Volume?

Choosing a value for pitch, rate, or volume requires testing, as the SSML 1.1 specification does not define standard values. Processors may support different formats, such as named labels or relative changes, which have different trade-offs.

This table breaks down the common approaches.

Value Type Conceptual Example Best For Pros Cons
Named "slow", "high" General adjustments where precision is not critical. Easy to read and understand. Imprecise; not standardized in SSML 1.1 and meaning varies widely by TTS provider.
Relative "+10%", "-5dB" Most use cases; preserving a voice’s natural character. Portable across phrases; adapts to the voice's baseline. Not all formats are standardized; requires testing to find the right amount.

As a general rule, start with the simplest value that achieves the goal and test the output. A named value like rate="slow" is often sufficient and more portable than a highly specific relative value.

Common Mistakes and How to Avoid Them

The most common mistakes when using SSML prosody are treating it as a deterministic command, over-marking text, and not testing across different voices. These errors can lead to unnatural-sounding speech. Avoiding them requires thinking of SSML as a tool for suggestion and refinement, not absolute control.

  • Forgetting SSML is a suggestion: Do not assume <prosody rate="slow"> will produce audio at exactly half the speed. The TTS engine will interpret the value and may clamp it within a "reasonable" range.
    • How to avoid: Test your markup with the target voice and listen to the result.
  • Over-marking text: Adding <break> tags after every comma or wrapping every other word in <emphasis> often sounds worse than the default synthesis.
    • How to avoid: Let the TTS engine handle standard punctuation and phrasing. Apply SSML only where the default prosody is wrong. Start small and make one change at a time.
  • Using non-portable values: A value that works for one voice may produce a very different effect on another.
    • How to avoid: Prefer values that are less specific unless you have a specific reason and are only targeting a single voice.
  • Not validating your XML: A missing closing tag or an unescaped character (&, <, >) can cause the entire synthesis request to fail.
    • How to avoid: Use an XML linter or validator to check your SSML syntax before sending it to the TTS service.
  • Excessive nesting: Nesting too many <prosody> tags can create confusing and unpredictable results, as inner tags modify outer tags.
    • How to avoid: Keep your markup as flat and simple as possible. If you must nest, test the combination carefully.

When should you NOT use SSML prosody?

You should avoid using SSML prosody when the default TTS output is already natural and clear. Modern neural TTS engines are very good at generating appropriate prosody from plain text alone. Over-marking can make speech sound robotic and less natural.

Here are a few specific situations where SSML is often unnecessary or unhelpful:

  • When the default is good enough. Always listen to the default output first. If it sounds right, don't add markup. SSML is for fixing problems, not for decorating text.
  • When you cannot test. SSML requires an iterative loop of changing the markup and listening to the result. If you are in an environment where you cannot easily test the audio output, you risk making things worse.
  • When you need direct acoustic control. SSML is a parametric control language, meaning it requests changes to acoustic dimensions rather than specifying the final audio signal itself (Source). If you need to edit the waveform directly for precise acoustic results, SSML is not the appropriate tool; that requires direct audio editing.

What to learn next

Sources and further reading