Testing SSML with the Text-to-Speech Simulator

The main subject of this chapter is using SSML to modify how responses returned from a skill will sound. Unfortunately, simply reading the words on the pages of this book can’t compare with actually hearing what effect SSML will have on text. Although it’s absolutely possible to write automated tests to assert that a skill’s response contains an expected SSML response, there’s no way to write a test to verify how it sounds.

The most important tool for testing SSML is your own ears. When Alexa speaks a response, you can deploy and interact with your skill, and listen and decide if it sounds the way you expected it and make adjustments if not. Even so, it’d be even better if there were a way to listen to how Alexa will speak an SSML response before you code it into your intent handler’s response.

Fortunately, Amazon has provided a useful (and incredibly fun) tool to listen to snippets of SSML. Under the “Test” tab of the developer console, you may have noticed a sub-tab labeled “Voice & Tone”. You can find it by opening any skill in the developer console, clicking on the “Test” tab at the top, and then clicking on “Voice & Tone” in the left-hand panel. You should see something like this:

images/ssml/VoiceAndToneConsole.png

On the left is Alexa’s text-to-speech simulator. It provides a text editor, in which you can write or paste in SSML. Once you’re ready to hear the results, make sure your volume is turned up and click the “Play” button at the bottom. Alexa will speak whatever the SSML in the text editor says she should speak.

For example, when you first open the text-to-speech simulator, it is already preloaded with this small bit of SSML:

 <speak>
  I want to tell you a secret.
  <amazon:effect name=​"whispered"​>I am not a real human.
  </amazon:effect>.
  Can you believe it?
 </speak>

If you leave this unchanged, then Alexa will say, in her normal voice, “I want to tell you a secret.” Then, she will whisper, “I am not a real human.” Finally, she will say, “Can you believe it?” in her normal voice.

When it comes to testing SSML, there’s no substitute for actually hearing the results. So you’ll definitely want to have the text-to-speech simulator in reach as you work through the examples in this. Be warned, however: you might find yourself having so much fun tinkering with different SSML incantations in the tool that you’ll lose hours of time.

We’re going to use SSML to add some flair to the Star Port 75 Travel skill’s responses. But before we inject any SSML into our skill’s code, let’s take a tour of some of the ways SSML can change how Alexa speaks. As we work through various SSML examples, use the text-to-speech simulator to try them out. We’ll begin our tour with SSML elements that change the sound of Alexa’s voice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset