Speech Synthesis Markup Language (SSML) overview
Speech Synthesis Markup Language (SSML) is an XML-based markup language that you can use to fine-tune your text to speech output attributes such as pitch, pronunciation, speaking rate, volume, and more. It gives you more control and flexibility than plain text input.
Tip
You can hear voices in different styles and pitches reading example text by using the Voice Gallery.
Use case scenarios
SSML is designed to give you flexibility in how you want your speech output to sound, and it provides different properties for how you can customize that output. You can use SSML to:
- Define the input text structure that determines the structure, content, and other characteristics of your text to speech output. For example, you can use SSML to define a paragraph, a sentence, a break or a pause, or silence. You can wrap text with event tags, like a bookmark or viseme, that your application can process later. A viseme is the visual description of a phoneme, the individual speech sounds, in spoken language.
- Choose the voice, language, name, style, and role. You can use multiple voices in a single SSML document. You can also adjust the emphasis, speaking rate, pitch, and volume. SSML can also insert prerecorded audio, such as a sound effect or a musical note.
- Control pronunciation of the output audio. For example, you can use SSML with phonemes and a custom lexicon to improve pronunciation. You can also use SSML to define how a word or mathematical expression is pronounced.
Ways to work with SSML
SSML functionality is available in various tools that might fit your use case.
Important
You're billed for each character that's converted to speech, including punctuation. Although the SSML document itself isn't billable, the service counts optional elements that you use to adjust how the text is converted to speech, like phonemes and pitch, as billable characters. For more information, see the pricing note.
You can use SSML in the following ways:
- The audio content creation tool lets you author plain text and SSML in Speech Studio. You can listen to the output audio and adjust the SSML to improve speech synthesis. For more information, see Speech synthesis with the Audio Content Creation tool.
- The batch synthesis API accepts SSML via the
inputs
property. - The Speech CLI accepts SSML via the
spx synthesize --ssml SSML
command line argument. - The Speech SDK accepts SSML via the "speak" SSML method across the different supported languages.