Using Language-Specific Voices

Most languages have special sounds that other languages don’t have, at least not directly. For example, consider the following SSML sample:

 <speak>
  <lang xml:lang=​"es-ES"​>
  Gatos y perros
  </lang>
 </speak>

This Spanish phrase, which means “cats and dogs”, employs a special Spanish sound in the word “perros”. The double-“r” should be made with a slight tongue roll. Instead, even with the <lang> tag, Alexa will pronounce it with a simple “r” sound. That’s because Alexa’s voice is based on English sounds, which do not include the rolled-“r” sound.

In the previous chapter, we looked at the <voice> tag, using it to swap out Alexa’s voice for that of Justin and Amy. While both of those voices are very different than Alexa’s native voice, they are still English voices and are still unable to speak other languages properly. However, Alexa supports several Polly voices suited for several locales:

  • U.S. English (en-US)—Ivy, Joanna, Joey, Justin, Kendra, Kimberly, Matthew, Salli

  • AustralianEnglish (en-AU)—Nicole, Russell

  • British English (en-GB)—Amy, Brian, Emma

  • IndianEnglish (en-IN)—Aditi, Raveena

  • German (de-DE)—Hans, Marlene, Vicki

  • American Spanish (es-US)—Penelope, Lupe, Miguel

  • Castilian Spanish (es-ES)—Conchita, Enrique, Lucia

  • Mexican Spanish (es-MX)—Mia

  • Hindi (hi-IN)—Aditi

  • Italian (it-IT)—Carla, Giorgio, Bianca

  • Japanese (ja-JP)—Mizuki, Takumi

  • French (fr-FR)—Celine, Lea, Mathieu

  • French Canadian (fr-CA)—Chantal

  • Portuguese Brazilian (pt-BR)—Vitoria, Camila, Ricardo

Not only do each of these voice possess a unique tone and personality, they are also based on their respective languages and are able to produce language-specific sounds.

For Spanish, we have the choice of either Conchita and Enrique. For example, try applying Conchita’s voice to the cats-and-dogs SSML:

 <speak>
  <voice name=​"Conchita"​>
  <lang xml:lang=​"es-ES"​>
  Gatos y perros
  </lang>
  </voice>
 </speak>

When tested in the text-to-speech simulator, you’ll hear a Spanish-speaking woman’s voice correctly pronouncing the phrase, including the rolled-“r” in “perros”.

If you’d like, you may apply these voices to the Star Port 75 Travel skill by sprinkling <voice> tags in our skill’s responses. The WELCOME_MSG_PERSONAL message, for instance, might employ Enrique’s voice if changed to look like this:

 WELCOME_MSG_PERSONAL:
 '<speak><voice name="Enrique"><lang xml:lang="es-ES">'​ +
 '¡Bienvenido de nuevo a Star Port 75 Travel, {{givenName}}! '​+
 '¿Como puedo ayudarte?'​ +
 '</lang></voice></speak>'​,

Polly voices such as Enrique and Conchita may not be a good fit for all skills, as they introduce a new personality that might be jarring to some users who are accustomed to Alexa’s voice. But they certainly do help a skill’s responses sound more natural when using non-English languages.

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

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