Text-to-Speech
Legal notice
<Say> and Text-to-Speech (TTS), including the <Say> TwiML verb and API, uses artificial intelligence or machine learning technologies. By enabling or using any features or functionalities within Programmable Voice that Twilio identifies as using artificial intelligence or machine learning technology, you acknowledge and agree to certain terms. Your use of these features or functionalities is subject to the terms of the Predictive and Generative AI or ML Features Addendum.
Availability of voices
Some features and voices, including third-party voices, in <Say> and Text-to-Speech may be available as alpha, beta, not generally available, limited release, or preview (collectively "Beta"), and information contained in this document might change. This means that some features might change before the product becomes Generally Available. The Twilio Service Level Agreement doesn't cover Beta products.
Use of third-party voices
Third-party voices might change without prior notice. Although Twilio provides access to these third-party voices, the third-party vendors control and update these voices. These changes include, but are not limited to, new models that affect how voices sound or the removal of voices from their offering with or without alternative or automatic redirections. To learn about third-party voice functionality, see the Text-to-Speech documentation for Google or Amazon.
Text-to-Speech (TTS) converts text into a human-sounding voice. To turn traditional human-to-human interactions into seamless, machine-to-human interactions, developers and business users use TTS. This replaces recording audio files with human voices for call playback. To respond to events in your app, TTS generates prompts from raw text, delivering information over a phone call with greater efficiency.
Twilio synthesizes speech from your text in real time and speaks the speech in any call. You can use TTS in TwiML and Twilio Studio.
To provide plain text that Twilio converts to synthesized speech, use the <Say> verb.
TwiML Hello World example
When Twilio executes the following TwiML during a call, the caller hears "Hello world!" in the default voice and language of the Twilio Account. You configure the default values in the Twilio Console.
1<Response>2<Say>Hello world!</Say>3</Response>
To modify the language, accent, and voice of the synthesized speech, use the language and voice attributes of the <Say> verb.
Amazon Polly Johanna voice and American English language example
The following TwiML uses Amazon Polly's "Joanna" voice and American English:
1<Response>2<Say language="en-US" voice="Polly.Joanna">Hello. I am Joanna and I speak American English!</Say>3</Response>
<Say> offers different options for voices. Each option offers its own supported set of languages and genders. To customize your app to your needs and preferences, use the Text-to-Speech capabilities.
To start using Text-to-Speech, complete the following steps:
- Configure your account-wide text-to-speech Settings in the Twilio Console.
- Define TTS instructions in a TwiML document with
<Say>.
You can choose from four types of Twilio Text-to-Speech: Basic, Standard, Neural and Generative. These types differ in their support of technologies, languages, locales, and quality of conversation.
These voices help you learn Text-to-Speech capabilities using <Say>. Don't use these voices for production apps. These voices lack enough human-like qualities for voice call conversation. Due to their limited purpose, these voices support few languages. Twilio provides these voices at no additional cost.
These voices use standard technology in synthesized speech. They produce natural-sounding lifelike voices but might have limited human speech patterns and inflections. These voices speak using Amazon Polly and Google Standard voices.
These voices use enhanced technology in synthesized speech. They produce higher-quality and more natural-sounding voices than Standard voices. These voices speak using Amazon Polly Neural and Google WaveNet and Neural2 voices.
These voices use the generative AI technology. They produce human-like voices with apparent emotional engagement and context awareness. These voices interpret the text-input and adjust their speech. These synthetic voices sound like human voices. This makes these voices the best option for Conversational AI apps and Virtual Agents. These voices speak using Amazon Polly Generative and Google Chirp3-HD voices.
Public Beta
Twilio provide generative voices as a Public Beta product. The information in this page might change. Some features might change before declaring the product as Generally Available. The Twilio Service Level Agreement doesn't cover Public Beta products.
Twilio supports a large range of languages and locale variants.
The format of the voice attribute depends on the TwiML verb as shown in the following table:
| TwiML verb | Voice value format | Example |
|---|---|---|
<Say> | {Provider}.{Voice} | Polly.Joanna-Generative |
<ConversationRelay> | {Voice} | Joanna-Generative |
The following table lists all voices available for each language and locale.
| Language (Locale) | Language code | Type | Gender | Provider | Voice |
|---|---|---|---|---|---|
Afrikaans (South Africa) | af-ZA | Standard | Female | af-ZA-Standard-A | |
Arabic (Gulf) | ar-AE | Neural | Female | Polly | Hala-Neural * |
Arabic (Gulf) | ar-AE | Neural | Male | Polly | Zayd-Neural * |
Arabic (Standard) | ar-XA | Generative | Female | ar-XA-Chirp3-HD-Aoede | |
Arabic (Standard) | ar-XA | Generative | Male | ar-XA-Chirp3-HD-Charon | |
Arabic (Standard) | ar-XA | Generative | Male | ar-XA-Chirp3-HD-Fenrir | |
Arabic (Standard) | ar-XA | Generative | Female | ar-XA-Chirp3-HD-Kore | |
Arabic (Standard) | ar-XA | Generative | Female | ar-XA-Chirp3-HD-Leda | |
Arabic (Standard) | ar-XA | Generative | Male | ar-XA-Chirp3-HD-Orus | |
Arabic (Standard) | ar-XA | Generative | Male | ar-XA-Chirp3-HD-Puck | |
Arabic (Standard) | ar-XA | Generative | Female | ar-XA-Chirp3-HD-Zephyr | |
Arabic (Standard) | ar-XA | Standard | Female | ar-XA-Standard-A | |
Arabic (Standard) | ar-XA | Standard | Male | ar-XA-Standard-B | |
Arabic (Standard) | ar-XA | Standard | Male | ar-XA-Standard-C |
The preceding table identifies bilingual voices with (*) in the Voice column. Only Amazon Polly supports this for a limited number of voices. To learn more about the bilingual voices, see the Amazon Polly documentation.
To test the different voices, go to the Text-to-Speech page in the Twilio Console.
Limited to <Say> and <Pay><Prompt>
The TTS Settings described in this section only apply to the <Say> TwiML verb and the <Pay> <Prompt> TwiML noun.
Text-to-Speech capabilities in <ConversationRelay> have their own settings and defaults for the voice attribute, which depends on the Provider and Language used.
To define the default voice and language for your account, go to the Text-to-Speech page in the Twilio Console.
- When you don't set
languageorvoiceattributes in your<Say>TwiML verb, it uses the default values. - When you select Default in Studio, it uses the default values.
Text-to-Speech Default Settings example
Consider that you set the Your default provider to Basic and set the Default voice to Man, en-US as your Default Settings.
When executing the following TwiML with these TTS settings, Twilio uses the Man voice and the en-US (American English) accent and pronunciation:
1<Response>2<Say>Hello. I am a man!</Say>3</Response>
Twilio updates the offered Text-to-Speech voices on a regular basis. To access the latest voices without needing to review and change your code, use the Language Mapping feature. Your app only needs the language and the text. Twilio selects and uses the corresponding voice. Update these at any time from the Twilio Console. On the Text-to-Speech page in the Twilio Console, you can set a voice for every locale.
To set a voice for a locale, complete the following steps.
- Go to the Text-to-Speech page in the Twilio Console.
- Under the Current Language Mapping heading, choose the language and locale you wish to configure.
In this example, choose English (British) (en-GB). The Test & Configure Voices By Language modal displays. - From the dropdown menus, select the Provider and Voice you wish to use.
In this example, choose Amazon Polly and Emma. - Click Save.
- Repeat these steps for other language and voice pairing you want to use.
With these mappings set, you can specify the language without specifying the voice when using the <Say> TwiML verb in your app.
Set language without voice example
Consider that you configured English (British) (en-GB) to use Amazon Polly Emma voice.
In the following TwiML example, Twilio uses the Amazon Polly Emma voice when executing <Say> with the language attribute set to en-GB. This didn't require a voice attribute.
1<Response>2<Say language="en-GB">Hello. I am Emma!</Say>3</Response>
Limited to <Say> and <Pay><Prompt>
The TTS Settings described in this section only apply to the <Say> TwiML verb and the <Pay> <Prompt> TwiML noun.
Text-to-Speech capabilities in <ConversationRelay> have their own settings and defaults for the voice attribute, which depends on the Provider and Language used.
To override default voice settings configured in the Twilio Console, change the <Say> voice attribute.
Change the voice for a specific call example
Consider that you set the default Text-to-Speech voice to Amazon Polly Salli in your account. You want to use Amazon Polly Joanna for a specific call. To use the Amazon Polly Joanna voice for a specific call, set the <Say> voice attribute to Polly.Joanna.
In the following TwiML example when executing <Say>, Twilio uses the Amazon Polly Joanna voice instead of Amazon Polly Salli voice.
1<Response>2<Say voice="Polly.Joanna">Hello. I am Joanna!</Say>3</Response>
To override a Language Mapping's defaults, add the voice attribute.
Override default language mapping for a specific call
Consider that you set the language mapping for English (British) (en-GB) to Amazon Polly Emma in your account. You want to use Amazon Polly Joanna for a specific call. To use the Amazon Polly Joanna voice for a specific call, set the <Say> voice attribute to Polly.Joanna.
1<Response>2<Say language="en-GB" voice="Polly.Joanna">Hello. I am Joanna!</Say>3</Response>
To override any default language settings configured in the Twilio Console, use the <Say> verb language attribute.
Language override example
Consider that you set your account's default Text-to-Speech Language to English (US) (en-US). To use German for a specific call, set the language attribute to de-DE.
In the following TwiML example, Twilio uses German (de-DE) language instead of English (US) (en-US) language when executing <Say>.
1<Response>2<Say language="de-DE">Hallo. Ich spreche Deutsch!</Say>3</Response>
To fine-tune synthesized speech, use Speech Synthesis Markup Language (SSML) tags. With SSML, you can specify where pauses should be, provide pronunciations for acronyms, abbreviations, dates and times, and increase or decrease the speed of spoken text. Basic voices don't support SSML.
To control the volume, rate, and pitch of synthesized speech, use the SSML <prosody> tag.
1<Response>2<Say voice="Polly.Joanna">3Prosody can be used to change the way words sound. The following words are4<prosody volume="x-loud"> quite a bit louder than the rest of this passage.5</prosody> Each morning when I wake up, <prosody rate="x-slow">I speak slowly and6deliberately until I have my coffee.</prosody> I can also change the pitch of my voice7using prosody. Do you like <prosody pitch="+5%"> speech with a pitch higher,</prosody>8or <prosody pitch="-10%"> is a lower pitch preferable?</prosody>9</Say>10</Response>
To choose how to pronounce a specific category of text, use the SSML <say-as> tag. This ensures that speech pronounces certain text as expected.
Without <say-as>, the voice pronounces a phone number like a number.
Pronunciation differences
Consider the number 4155551212.
Use <say-as> | Read as | Voice says |
|---|---|---|
| No | A number | four billion, one hundred fifty-five million, five hundred fifty-one thousand, two hundred twelve |
| Yes | A phone number | four one five, five five five, one two one two |
1<Response>2<Say voice="Polly.Joanna">3John's phone number is, <say-as interpret-as="telephone">4155551212</say-as>4</Say>5</Response>
To generate TwiML with SSML within the <Say> verb, use a Twilio SDK: C#, Go, Java, Node.js, PHP, Python, or Ruby.
This SDK code generates the TwiML with SSML.
1const VoiceResponse = require('twilio').twiml.VoiceResponse;23const response = new VoiceResponse();4const say = response.say(5{6voice: 'Polly.Joanna',7},8'Hi'9);10say.break({11strength: 'x-weak',12time: '100ms',13});14say.emphasis(15{16level: 'moderate',17},18'Words to emphasize'19);20say.p('Words to speak');21say.addText('aaaaaa');22say.phoneme(23{24alphabet: 'x-sampa',25ph: 'pɪˈkɑːn',26},27'Words to speak'28);29say.addText('bbbbbbb');30say.prosody(31{32pitch: '-10%',33rate: '85%',34volume: '-6dB',35},36'Words to speak'37);38say.s('Words to speak');39say.sayAs(40{41'interpret-as': 'spell-out',42role: 'yyyymmdd',43},44'Words to speak'45);46say.sub(47{48alias: 'alias',49},50'Words to be substituted'51);52say.w('Words to speak');5354console.log(response.toString());
1<Response>2<Say voice="Polly.Joanna">3Hi4<break strength="x-weak" time="100ms"/>5<emphasis level="moderate">Words to emphasize</emphasis>6<p>Words to speak</p>7aaaaaa8<phoneme alphabet="x-sampa" ph="pɪˈkɑːn">Words to speak</phoneme>9bbbbbbb10<prosody pitch="-10%" rate="85%" volume="-6dB">Words to speak</prosody>11<s>Words to speak</s>12<say-as interpret-as="spell-out">Words to speak</say-as>13<sub alias="alias">Words to be substituted</sub>14<w>Words to speak</w>15</Say>16</Response>
- Basic voices can process no more than 4,000 characters.
- Basic voices don't support SSML tags.
<Say>can't process more than 3,000 characters excluding the SSML tags.<Say>doesn't support Amazon-specific SSML tags. These would include<amazon:auto-breath>or<amazon:effect>.<Say>doesn't support lexicons.- SSML support might vary between Polly and Polly Neural voices.
To review any differences, see the Amazon Polly SSML documentation.
<Say>can process no more than 5,000 characters, including SSML, newlines and spaces.- As Google includes SSML tags, newlines and spaces in the total character count, they count toward Google billing totals.
<Say>doesn't support Google-specific SSML tags. This includes<par>or<seq>.- SSML support may vary between Standard, WaveNet and Neural2 voices.
To review any differences, consult the [Google SSML documentation][].
Basic voices are free of charge. For Standard, Neural, and Generative voice pricing, see Voice pricing. Twilio rounds usage towards the end of call and prices it in blocks of 100 characters. The minimum charge covers 100 characters.
AI Nutrition Facts
<Say> - Amazon Polly Text-to-Speech
- Description
- Convert text into a human-sounding voice using speech synthesis technology from Amazon Polly.
- Privacy Ladder Level
- N/A
- Feature is Optional
- Yes
- Model Type
- Generative and Predictive
- Base Model
- Amazon Polly Text-to-Speech: Standard, Neural and Generative
- Base Model Trained with Customer Data
- No
- Customer Data is Shared with Model Vendor
- No
- Training Data Anonymized
- N/A
- Data Deletion
- N/A
- Human in the Loop
- Yes
- Data Retention
- 30 days
- Logging & Auditing
- Yes
- Guardrails
- Yes
- Input/Output Consistency
- Yes
- Other Resources
- https://www.twilio.com/docs/voice/twiml/say/text-speech
Trust Ingredients
The Base Model is not trained using Customer Data.
Programmable Voice uses the default Base Model provided by the Model Vendor. The Base Model is not trained using customer data.
The Base Model is not trained using Customer Data.
The Base Model is not trained using Customer Data.
Customers can view text input and listen to the audio output.
Compliance
Customers can view text input and listen to the audio output.
Customers can view text input and listen to the audio output.
Customers are responsible for human review.
Learn more about this label at nutrition-facts.ai
AI Nutrition Facts
<Say> - Google Text-to-Speech
- Description
- Convert text into a human-sounding voice using speech synthesis technology from Google.
- Privacy Ladder Level
- N/A
- Feature is Optional
- Yes
- Model Type
- Generative and Predictive
- Base Model
- Google Text-to-Speech: Standard, WaveNet, Neural2 and Chirp3-HD
- Base Model Trained with Customer Data
- No
- Customer Data is Shared with Model Vendor
- No
- Training Data Anonymized
- N/A
- Data Deletion
- N/A
- Human in the Loop
- Yes
- Data Retention
- 30 days
- Logging & Auditing
- Yes
- Guardrails
- Yes
- Input/Output Consistency
- Yes
- Other Resources
- https://www.twilio.com/docs/voice/twiml/say/text-speech
Trust Ingredients
The Base Model is not trained using Customer Data.
Programmable Voice uses the default Base Model provided by the Model Vendor. The Base Model is not trained using customer data.
The Base Model is not trained using Customer Data.
The Base Model is not trained using Customer Data.
Customers can view text input and listen to the audio output.
Compliance
Customers can view text input and listen to the audio output.
Customers can view text input and listen to the audio output.
Customers are responsible for human review.
Learn more about this label at nutrition-facts.ai