Question
Why is my SSML <break> tag no longer working or being ignored inside a Twilio Studio Say/ Play widget when using a Text-to-Speech voice like Matthew Neural?
Product
Twilio Studio
Answer
When you add SSML (Speech Synthesis Markup Language) tags like <break time="9s" /> to a text block, the Twilio Text-to-Speech engine must parse the entire string as XML code.
If your text contains a raw ampersand symbol (&), it violates XML syntax rules. This causes the XML parser to fail, which results in the engine ignoring your SSML tags or failing to process the speech text altogether.
To fix this issue, you must escape the ampersand symbol by replacing it with its valid XML entity equivalent: &
- Broken Example: >
Welcome to Sales & Support. <break time="2s" /> Please hold. - Fixed Example: >
Welcome to Sales & Support. <break time="2s" /> Please hold.
Additional Information
If your message text includes any other special XML characters within an SSML-enabled block, they must also be escaped: & as &, < as <, > as >, " as ", and ' as '.