Amazon Polly text-to-speech (TTS) functionality is now available with the the Twilio <Say>
TwiML verb. This enhancement gives your Programmable Voice applications access to additional TTS voices, languages, and more granular controls.
For more details on the supported languages with <Say>, please see our article What Languages can the <Say> Verb Speak?
Change Your Project's Default TTS Voices
- Login to your account at www.twilio.com/console.
- Click Programmable Voice from the left-side navigation bar.
NOTE: If Programmable Voice is not visible, you may first need to click All Products & Services. - Click TwiML > Text-to-Speech.
- Under the "Current Language Mapping" section, click the desired language to modify the default TTS provider and voice, or click the red + sign icon to add a language that isn't listed.
- Select the desired options from each drop-down menu, and then click Save. Enter some text in the empty field and then click TEST THIS VOICE to hear a sample.
- Language: The text-to-speech language
- Provider: Either Amazon Polly, or Basic (Twilio default)
- Voice: The desired voice tone; varies between providers.
Change TTS Voices in TwiML
You can also request specific voices be used on your calls directly in your TwiML response, regardless of your project's current TTS settings.
Using the <Say> TwiML Verb's language
and voice
attributes, you can specify any of a number of available speaking styles for your voice calls. Here’s an example TwiML script:
<Response>
<Say voice="Polly.Kimberly" language="en-US">Hello from Kimberly</Say>
</Response>
This example will use the English (United States) voice Kimberly to read the following message:
Hello from Kimberly
For full details on using Amazon Polly voices with the <Say> TwiML verb, please see Twilio Docs: Text-to-Speech.
Advanced TTS Controls
Amazon Polly voices also support Speech Synthesis Markup Language (SSML) for refining your TTS scripts. SSML allows you to customize pronunciations, pitch, speed, and volume, and add breaks, emphasis, and more. For full details on the supported SSML commands, including usage instructions and code samples, please see Twilio Docs: Text to Speech - SSML.
Pricing
Amazon Polly voices start at $0.0008 per each 100 characters, with volume discounts available. For full details, please see Twilio Docs: Text to Speech - Pricing.