SSML Tags
In this tutorial, you’ll learn about SSML tags that can help customize your audio response in your text-to-speech application. This tutorial assumes you’ve already set up your developer account and environment and you know how to send commands and receive webhooks using the Telnyx Voice API.What are SSML tags?
Speech Synthesis Markup Language (SSML) is an XML-based markup language that is used to generate synthetic speech for appliations. SSML tags are used to change the tone of speech in the application by adjusting pitching, volume, duration of speech, and more.SSML tag examples
Adding a pause
SSML Tag:<break> </break>
There are 2 ways for defining the length of the pause by using the following attributes:
- Time: Defines the number of s or ms
- Strength: Chooses the strength using the following values:
- None: no pause
- Pause: the same duration as after a period
- x-weak: the same as none.
- 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.
Emphasizing words
SSML Tag:- Strong - increases the volume and slows the speaking rate
- Moderate - increases the volume and slows the speaking rate, but less than Strong
- Reduced - decreases the volume and speeds up the speaking rate
Set a different language
SSML Tag:Adding a pause between paragraphs
SSML Tag:Using phonetic pronunciation
SSML Tag:- Alphabet, with the following options:
- ipa, meaning the International Phonetic Alphabet (IPA) will be used
- x-sampa, which indicates that the Extended Speech Assessment Methods Phonetic Alphabet (X-SAMPA) will be used.
- ph, specifies how the text should be pronounced.
Controlling volume, speaking rate, and pitch
SSML Tag::- Volume:
- default: resets the volume to default value
- silent, x-soft, soft, medium, loud, x-loud: sets the volume to predefined value
- +ndB, -ndB: changes the volume relative to the current level
- Rate:
- x-slow, slow, medium, fast,x-fast: sets the pitch to a predefined value
- n%: a percentage change in speaking pace.
Adding a pause between sentences
SSML Tag:Controlling how special words are spoken
SSML Tags:- characters or spell-out
- cardinal or number
- digits
- fraction
- unit
- date
- time
- address
- telephone.