How To Create Text-To-Speech Audio Files –
SSML Markup Tags: Quick Reference Guide
Please refer to the SSML markup tutorials for detailed information about using SSML tags to markup
text and the accompanying cheat sheets in this course for additional quick reference resources.
Overview
Prosody refers to areas of language like the tune, rhythm, stress and intonation of speech and how these
features contribute to meaning. Prosodic, therefore, refers to aspects of prosody.
<speak>
This SSML tag can be used with Google TTS and Amazon Polly.
The speak tag is the root element of all SSML text.
Text must be enclosed within a pair of speak tags to be converted into speech.
Add an opening speak tag <speak> to the beginning of your text. Add a closing speak tag </speak> to the
end of your text file.
Here is an example of how to use the speak tag in your text file. Note that all the content you want to
convert into speech is enclosed within the opening and closing speak tags
Wrap everything with <speak></speak> tags:
<speak>Hello</speak>
© [Link] 1
Adding Pauses To Words & Sentences
The <break/> tag lets you add pauses to words, sentences and paragraphs in your text-to-speech files.
The break tag is an empty element, which means that it produces no sound. It controls pausing or other
prosodic boundaries between words.
Note that using break tags is completely optional. If this element is not present between words, the
break will be automatically determined based on how the text-to-speech engine processes the linguistic
context.
In other words, even if you don't add break tags, a TTS engine will naturally add a pause after finding
certain grammatical features like punctuation in your text, such as periods and commas.
A break tag, then, allows you to finetune the spacing of pauses and breaks between words, sentences,
and paragraphs.
If you add a break tag after a word, sentence, or paragraph, a break will be inserted with a prosodic
strength greater than if no break element is supplied.
In other words, the text-to-speech engine will determine the linguistic context of your text and increase
the natural pause if it detects a break tag in your content.
So, while a sentence with no break tags will have natural pauses added, adding break tags can extend
those pauses and create a more lifelike feel to your narration.
© [Link] 2
The break tag also lets you use optional attributes, like time and strength.
• time (<break time="?"/>) and
• strength (<break strength="?"/>)
Using a break tag with the time attribute lets you fine tune your narrations by setting the length of your
break or pause using seconds or milliseconds. For example, 3 seconds, or 200ms.
For example:
• <break time="1s"/>
• <break time="2s"/>
• <break time="3s"/>
• <break time="250ms"/>
• <break time="500ms"/>
• <break time="800ms"/>
© [Link] 3
If you use Amazon Polly to convert your text files into speech, please note that the maximum duration
amount you can specify in the break tag is 10 seconds, or 10,000 milliseconds.
Using a break tag with the strength attribute also lets you fine tune your narrations by setting the length
of your breaks or pauses using relative values, such as:
• extra strong: <break time=“x-strong”/>
• strong: <break time=“strong”/>
• medium: <break time=“medium”/>
• weak: <break time=“weak”/>
• extra weak: <break time=“x-weak”/>
• none: <break time=“none”/>
Use the value “none” to prevent a prosodic break or pause that your text-to-speech processor would
otherwise produce and insert into your narration.
If using Amazon Polly, strength attribute values are equivalent to pausing after a comma, sentence, or
paragraph:
• none: No pause. Use none to remove a normally occurring pause, such as after a period.
• x-weak: Has the same strength as none, no pause.
• weak: Sets a pause of the same duration as the pause after a comma.
• medium: Has the same strength as weak.
• strong: Sets a pause of the same duration as the pause after a sentence.
• x-strong: Sets a pause of the same duration as the pause after a paragraph.
Additionally, if you don't use attributes with the break tag (i.e. use only <break/>) when processing text-
to-speech with Amazon Polly, the results vary depending on your text.
• If there is no other punctuation next to the break tag, it creates a break strength of medium
value, which is the equivalent of a comma-length pause.
• If the tag is next to a comma, it upgrades the tag to a strong break tag, which is the equivalent of
a sentence-length pause.
• If the tag is next to a period, it upgrades the tag to an extra strong break tag, or the equivalent
of a paragraph-length pause.
The break tag, then, lets you specify exact pause durations between words, sentences and paragraphs
and can be used to enhance the lifelike aspect of your voice narrations.
Summary:
Use break tags with time attribute to specify breaks using seconds or milliseconds:
• <break time="3s" />
• <break time="500ms" />
Use break tags with strength attribute to specify breaks using relative values:
• <break strength="none" /> <!—Amazon Polly removes pause after period -->
© [Link] 4
• <break strength="x-weak" /> <!—Amazon Polly treats this the same as “none” -->
• <break strength="weak" /> <!-- Amazon Polly treats this like a comma -->
• <break strength="medium" /> <!—Amazon Polly treats this the same as “weak” -->
• <break strength="strong" /> <!-- Amazon Polly treats this like a sentence break (period) -->
• <s>Sentence</s>
• <break strength="x-strong" /> <!-- Amazon Polly treats this like a paragraph break -->
• <p>Paragraph</p>
Text Interpretation
The <say-as> element lets you specify how certain characters, words, and numbers in your text-to-
speech file should be spoken.
A <say-as> tag requires using the <interpret-as> attribute, which determines what is being
processed.
Optional attributes like <format> and <detail> can also be used, depending on the element selected.
The structure for marking up text to interpret <say-as> values is shown below.
• <say-as interpret-as="characters">hello</say-as> <!-- or "spell-out" -->
• <say-as interpret-as="cardinal">150</say-as> <!-- or "number" -->
• <say-as interpret-as="ordinal">3</say-as>
• <say-as interpret-as="digits">7124</say-as>
• <say-as interpret-as="fraction">1/3</say-as>
• <say-as interpret-as="unit">4dB</say-as>
• <say-as interpret-as="date">20181031</say-as>
• <say-as interpret-as="date" format="ymd">20181031</say-as> <!-- any combination of ymd -->
• <say-as interpret-as="time">1'21"</say-as>
• <say-as interpret-as="telephone">1234567</say-as>
• <say-as interpret-as="telephone">1234567890</say-as>
• <say-as interpret-as="address">123 The Avenue, Town, 54321, Country </say-as> <!-- street -->
• <say-as interpret-as="expletive">Becomes beeeep</say-as>
Additionally …
© [Link] 5
• <say-as interpret-as="interjection">oh no</say-as>
• <!-- [Link]
[Link]#supported-speechcons -->
Additional Info: See ”Say-As” Slides Document for more details.
Emphasis (Speed & Volume)
Emphasis Tags:
• <emphasis level="strong">Slower and louder text</emphasis>
• <emphasis level="moderate">Normal text</emphasis>
• <emphasis level="reduced">Faster and softer text</emphasis>
Prosody: Volume, Pitch & Rate
Prosody Tags:
Volume
• <prosody volume="silent">Text</prosody>
• <prosody volume="x-soft">Text</prosody>
• <prosody volume="soft">Text</prosody>
• <prosody volume="medium">Text</prosody>
• <prosody volume="loud">Text</prosody>
• <prosody volume="x-loud">Text</prosody>
• <prosody volume="+6dB">Text</prosody> <!-- max +4.08dB -->
Pitch
• <prosody pitch="x-low">Text</prosody>
• <prosody pitch="low">Text</prosody>
• <prosody pitch="medium">Text</prosody>
• <prosody pitch="high">Text</prosody>
• <prosody pitch="x-high">Text</prosody>
• <prosody pitch="+10%">Text</prosody> <!-- max +50% -->
• <prosody pitch="-10%">Text</prosody> <!-- min -33.3% -->
Rate
• <prosody rate="x-slow">Text</prosody>
• <prosody rate="slow">Text</prosody>
• <prosody rate="medium">Text</prosody>
© [Link] 6
• <prosody rate="fast">Text</prosody>
• <prosody rate="x-fast">Text</prosody>
• <prosody rate="100%">Text</prosody> <!-- min 20% -->
Specify Pronunciation
Use the <sub alias> tag to pronounce abbreviations and acronyms:
• <sub alias="magnesium">Mg</sub>
• <sub alias="World Health Organization">WHO</sub>
Note: As Google TTS currently doesn’t interpret phonemes, use the <sub alias> tag as a workaround if
you need to pronounce words differently.
Embed Audio File
Use <audio> tags to include other audio in your text files:
<audio src="[Link]
<audio repeatCount="3" soundLevel="+2.28dB" fadeInDur="1s" fadeOutDur="1s src="https://
[Link]/folder/[Link]">AudioDescription</audio>
Notes:
• URL of audio must be ‘https’
• You can use .WAV, .MP3, .OGG audio files
• Amazon Polly = MP3 sound (max 240 seconds and no more than five)
Amazon Polly
The following SSML tags currently work only with Amazon Polly voices:
Phonemes
Use phoneme tags to pronounce words differently:
• <phoneme alphabet="ipa" ph="ˈbɑ.təl">bottle</phoneme>
• <phoneme alphabet="x-sampa" ph=""bA.t@l">bottle</phoneme>
© [Link] 7
Whispered Voice
Use the whispered tag to create a whispering voice effect:
• <amazon:effect name="whispered">Whispered text</amazon:effect>
Languages
Use the language tag when you want your selected voice to speak certain words or sections of the text
from another language.
<lang xml:lang="de-DE">Entschuldigung</lang>
<!-- en-US, en-GB, en-IN, en-AU, en-CA, de-DE, es-ES, it-IT, ja-JP, fr-FR -->
Note: Unless the text has been translated into the other language, the selected voice will narrate the
text in the language of the content with a distinctive accent.
For example:
• English voice speaking English words = English sounding narration.
• English voice speaking French words = French words spoken with an English accent.
• French voice speaking French words = French words spoken with a French accent.
• French voice speaking English words = English words spoken with a French accent.
Part Of Speech Pronunciation
Use the <w> tag to instruct voices how to say words in a different way (e.g. the word “read” in “I read
the book” – will sound differently depending on whether it refers to the past or the present).
• <w role="amazon:VB"></w> <!-- present simple -->
• <w role="amazon:VBD"></w> <!-- past participle -->
• <w role="amazon:NN"></w> <!-- noun -->
• <w role="amazon:SENSE_1"></w> <!-- use the non-default pronunciation -->
© [Link] 8