Skip to main content

SSML Tags for Text-to-Speech Customization

SSML (Speech Synthesis Markup Language) tags allow you to customize how a text-to-speech engine generates audio.

Why Use SSML?

SSML gives you precise control over speech characteristics like pauses, pitch, speed, and pronunciation, enabling natural and context-appropriate audio output.

Reverie TTS Support

Reverie’s TTS API supports SSML to structure text, switch voices, and customize pronunciation for various formats like dates, currencies, and units.

Core SSML Tags

<speak> and <voice>

The root element for any SSML document. Surround all text to be spoken with this tag.
Note: The <speak> tag is mandatory.
Encapsulates text and other tags, specifying the voice to use via the name attribute. Supports multiple voices in a single request.
<p> represents a Paragraph. Use the tag to add a pause between paragraphs in the text. Note: By default, the API will separate the paragraphs by 800ms break.
<s> represents a Sentence. Use the tag to add a pause between lines or sentences in the text. Note: By default, the API will separate the sentences within a paragraph by a 400ms break.
Recommend using the <p> and <s> tags to structure your requests, especially when using <break>.
For <speak> Tag:
For <voice> Tag:

<break>

It represents a pause in the speech. Set the length of the pause with the time attribute. Add pause of a specified duration, either in seconds or milliseconds.
<break> is currently not supported within a sentence. It can only exist before or between sentences or paragraphs.

<sub>

Pronounce the specified word or phrase as a different word or phrase. Specify the pronunciation to substitute with the alias attribute.

<say-as>

The <say-as> tag will allow you to provide instructions for how to speak a text file. The TTS engine will automatically detect many of these features, but the say-as command will enable you to mark them specifically. Use the <say-as> tag with the interpret-as attribute to tell the TTS how to speak certain characters, words, and numbers.

Cardinal

Interprets the numerical text as a cardinal number, as in 1,2,3,4
By default, the API will understand and pronounce the numbers in Cardinal format. Example: The API will interpret 1234 as One thousand two hundred and thirty-four.

Ordinal

This value will interpret and speak the ordinal value for the given digit within the enclosed tag.

Character

This value will speak the characters in a given text within the enclosed tag.

Digits

This value spells out the digits in a given number within the enclosed tag.

Units

Interpret a value as a measurement. The value should be a number followed by a unit or just a unit. The units supported by the TTS API are:

Date

This value will speak the enclosed tag’s date, using the format given in the associated format attribute. The format attribute is mandatory for use with the date value of interpret-as.
Supported Date Formats:

Currency

Use the currency parameter to control the synthesis of monetary quantities. The currency formats supported and spoken by the API is:

URL

This value is used to control the synthesis of the website address.
By default, the API will interpret the website address and speak in the right format. The API will pronounce symbols as present in a web address. Example: reverieinc.com is pronounced as reverieinc dot com

<prosody>

The prosody element can be used to adjust the below-listed attributes for the text-to-speech output.