Speech synthesis markup
Speech Synthesis Markup Language (SSML) is an XML-based markup language for speech synthesis. SSML allows you to customize the bot’s speech more flexibly, making it more natural and expressive.
You can check the list of supported SSML tags in the documentation of the selected provider. JAICP supports SSML for the following TTS providers:
There are several ways you can use SSML in the script:
-
The
areaction tag. Specify thettsparameter after the tag and pass the text with markup as its value:a: You shall not pass! || tts = "<emphasis>You</emphasis> shall not pass!" -
Replies with the
texttype. Pass the text with markup in thettsproperty of the reply object:script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "text",
"text": "Cr is my favorite chemical element.",
"tts": "<sub alias=\"Chromium\">Cr</sub> is my favorite chemical element."
}); -
The
$reactions.answermethod. Pass the text with markup in thettsproperty of the method argument:script:
$reactions.answer({
"value": "Lucky you! You get 10% off your next purchase!",
"tts": "Lucky you! <break time=\"1s\"> You get ten per cent off your next purchase!"
});