Lesson 2 of 2 Speech Recognition and Synthesis Concepts

Generating Spoken Audio with Speech Synthesis and SSML

This lesson explains speech synthesis, or text to speech (TTS), which converts text into spoken audio. It powers voice responses, accessibility features, announcements and narration.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how a synthesis system analyzes text and predicts prosody.
  • Explain how Speech Synthesis Markup Language (SSML) controls how text is spoken.
  • Describe how speech translation and voice agents combine recognition and synthesis.

How speech synthesis works

A synthesis system first analyzes the text: it expands abbreviations and numbers (Dr., 3:45), breaks text into words and determines pronunciation as phonemes, and predicts prosody, the rhythm, stress and intonation of natural speech. A neural voice model then generates the audio waveform. Azure Speech provides hundreds of neural voices in many languages, some of which can speak several languages or express styles such as cheerful or empathetic, and high-definition voices with more natural expression.

The following diagram shows the steps from text to audio.

How speech synthesis works. The system first analyzes the text: it expands abbreviations and numbers, such as Dr. and 3:45, determines the pronunciation of each word as phonemes, and predicts prosody, the rhythm, stress and intonation of natural speech. A neural voice model then generates the audio waveform.
Text analysis decides what to say; the neural voice decides how it sounds.
Put in order

From text to voice

Exam skills 1.3.3

Put the stages of speech synthesis in order.

Log in to try this activity Interactive activities are free with an account.

Controlling speech with SSML

Plain text uses the voice's default delivery. Speech Synthesis Markup Language (SSML) is an XML format that controls how text is spoken. Elements set the voice, insert pauses (break), change rate, pitch and volume (prosody), specify how to read content such as dates, numbers or spelled-out codes (say-as), give exact pronunciations (phoneme) and select speaking styles.

Output formats include WAV, MP3 and other encodings at different sample rates, chosen to suit telephony, web or high-quality narration. Custom voice lets an organization create a branded voice under Microsoft's responsible AI requirements.

Match the pairs

SSML elements

Exam skills 1.3.3

Match each SSML element with what it controls.

Log in to try this activity Interactive activities are free with an account.

Speech-to-speech solutions

Recognition and synthesis combine into speech translation, which recognizes speech in one language and returns text or speech in another, and into voice agents. A voice agent can chain speech to text, a language model and text to speech, or use the Voice Live API, which manages the whole loop with low latency, noise suppression, detection of when the user has finished speaking and handling of interruptions.

Scenario questions

Speech in, speech out

Exam skills 1.3.3

Choose the speech-to-speech approach for each scenario.

Log in to try this activity Interactive activities are free with an account.
Worked example

Controlling pronunciation

An airline's phone system reads booking references such as QX7B2, but the voice reads QX as a word and runs the reference into the next sentence. How should the developer fix this?

Use SSML: a say-as element with interpret-as="characters" makes the voice spell the reference character by character, and a break element adds a pause after it. Choosing a different neural voice would not change how the reference is interpreted, and speech recognition settings affect input, not output.

Check yourself

What is SSML used for?

Show answer

Controlling synthesized speech: the voice, pauses, rate, pitch, pronunciation and how content is read.

Exam Tips

Remember for the exam

  • Neural voices generate natural speech; prosody is rhythm, stress and intonation.
  • SSML controls voice, pauses, rate, pitch, pronunciation and how content is read.
  • Voice Live combines recognition, a model and synthesis for real-time voice agents.