Server Infrastructure Required

This lab can be completed if you have access to the server infrastructure in a private lab or if you are at an event such as Cisco Live!

Speaking Multiple Languages

Level: Beginner

Tropo provides many different voice options to choose from in order to work with multinational callers. In this lab, you'll learn to use the say method to create apps that speak in different languages and use different voices.

Objective

Completion Time: 10 minutes

  • Understand how to change languages with Tropo Speech
  • Understand what happens when pronouncing foreign words.

Prerequisites

  • You should have some basic knowledge of Javascript before you start this lab.
  • You'll need to know another language or find a web-based translation service to create a few phrases in another language.

Getting Started

  1. From the Tropo dashboard, log into your account and click Create New App.
  2. Name the new app 'Speaking Multiple Languages'.
  3. Select Scripting API under Type of Application.
  4. Open the script editor by clicking the pencil icon titled New script.
  5. Write a simple say command:

    say("Hello. Where is the library?");
    
  6. Name your script 'voices.js', save and close it.

  7. Select a Country and Region to associate a phone number with your app and click CREATE APP.

    Note: Provisioning new numbers may take a few minutes. If your app doesn't work immediately, wait a few minutes and try again.

  8. Test your app by calling the number and listening to the message.

    By default, Tropo will play back messages using a female US English voice. You can change the voice in order to have your message spoken with the regional accent or language of your choosing.

    The voice for a say command can be specified using the voice property.

  9. Edit your script and change the voice to the English (Irish) voice, Veena.

    say("Hello. Where is the library?", {voice:"Veena"});
    
  10. Call the number associated with your script to hear the message in a different voice.

    You can create applications that speak in many different languages, but it's up to you to select the appropriate voice for the language. Mispronunciations can occur when you select a voice that doesn't match the language used. Let's try it out.

  11. Edit your script and write your message in French. Change the voice to the US English voice Tom.

    say("Bonjour. Où est la bibliothèque?", {voice:"Tom"});
    
  12. Save you file and call the number to listen to the message.

    It sounds like an American trying to use the French he learned 20 years ago! Because the voice is US English, it doesn't know French, so it pronounces everything phonetically.

  13. Change your script to the French voice Aurelie, and leave the message the same.

  14. Save your script and call the number to hear the message.

    say("Bonjour. Où est la bibliothèque?",{voice:"Aurelie"});
    

    Much improved, oui?