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
a
reaction tag. Specify thetts
parameter 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
text
type. Pass the text with markup in thetts
property 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.answer
method. Pass the text with markup in thetts
property 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!"
});