SSML is an XMLbased markup language that gives developers finegrained control over how text is turned into spoken audio by a speech synthesis engine. By adding tags to ordinary text, you can influence pronunciation, intonation, speed, volume, pauses, and many other aspects of the spoken output.
The root element that encloses all SSML content. It can include a version attribute, although its optional in most implementations.
Selects a specific voice or language. Attributes such as name, language, and gender are commonly supported.
<speak> <voice name="enUSEmmaNeural">Hello, world!</voice></speak>
Introduces a pause. Use the time attribute (e.g., time="500ms") or strength (e.g., strength="medium").
<speak> Welcome to the tutorial.<break time="800ms"/>Let's begin.</speak>
Modifies pitch, rate, and volume within its scope.
<speak> <prosody rate="slow" pitch="+2st">This sentence is spoken slowly with a higher pitch.</prosody></speak>
Provides a phonetic transcription when the engine mispronounces a word. The alphabet attribute selects the phoneme set (e.g., ipa or xsampa).
<speak> The word <phoneme alphabet="ipa" ph="d">good</phoneme> is pronounced correctly now.</speak>
Substitutes displayed text with an alternative pronunciation without changing what appears on the screen.
<speak> The abbreviation <sub alias="World Wide Web">WWW</sub> is spoken as World Wide Web.</speak>
Specifies how to interpret a string: date, time, telephone, ordinal, etc.
<speak> The meeting is on <say-as interpret-as="date">20241015</say-as>.</speak>
Inserts a prerecorded audio clip, useful for sound effects or background music.
<speak> <audio src="https://example.com/chime.mp3"/>Your timer is complete.</speak>
IVR systems often need clear instructions, pauses for user input, and distinct voices for different menu levels.
<speak> <voice name="enUSJohnNeural"> Welcome to Acme Bank.<break strength="strong"/> Foraccount balances , say <sub alias="balance">bal</sub>.<break time="500ms"/> Forcustomer support , say <sub alias="support">sup</sub>.<break time="1s"/> <prosody rate="fast">How may I help you today?</prosody> </voice></speak>
When teaching technical terms, you may need precise pronunciation and occasional emphasis.
<speak> In computer science, <phoneme alphabet="ipa" ph="lgorm">algorithm</phoneme> refers to a stepbystep procedure.<break time="400ms"/> The term <sub alias="hypertext markup language">HTML</sub> is pronounced as <phoneme alphabet="ipa" ph="et ti m l">HTML</phoneme>.</speak>
<break> sparingly. Too many pauses can sound robotic.Most major speech services accept SSML, including:
<, >, and & inside text nodes.<emphasis> or extreme prosody values can degrade intelligibility.The following snippet works on most platforms and demonstrates the basic structure:
<?xml version="1.0"?><speak> Hello, I am <voice name="enGBGeorgeNeural">George</voice>. <break time="300ms"/> Today is <say-as interpret-as="date">20240613</say-as>.</speak>
With SSML you can transform raw text into a rich, expressive voice experience that feels natural and tailored to your audience. By mastering its core elements and applying best practices, developers can unlock the full potential of modern speech synthesis.
