Skip to navigation

Amazon Polly

Text-to-speech

View as MarkdownOpen in Claude

Amazon Web Services’ Polly TTS engine includes several models to accommodate different use cases.

Models

SignalWire supports the following three Amazon models.

Voices

Press play to audition any Amazon Polly voice, then copy config to grab the value for SWML or your SDK.

Languages

Consult AWS documentation for a comprehensive and up-to-date list of supported voices, as well as information on accented and fully bilingual voices.

Usage

Amazon voice IDs conform to the following format:

amazon.<voice>:<model>:<language>
ParameterPossible valuesDescription
engine
required
  • amazon
  • polly (will be deprecated in the future)
TTS engine
voice
required
Choose from the Name/ID columnVoice ID
model
optional
standard, neural, or generativeAmazon Polly model. Default: standard
language
optional
Choose from the Language code columnSets model language. Default: en-US

Examples:

amazon.Joanna
amazon.Joanna:standard:en-US
amazon.Kendra:neural:en-US
amazon.Matthew:neural:en-US
amazon.Danielle:generative:en-US
amazon.Amy:generative:en-GB
amazon.Aditi:standard:hi-IN

Simplified Format:

For voices that only support one model, you can omit the model parameter:

amazon.<voice>:<language>

Example: amazon.Aditi:hi-IN (Standard model implied)

The polly engine code is being deprecated. Use amazon instead.

Amazon Polly has a limit of 3000 chargeable characters in a single request. If your TTS request is longer than 3000 characters, you will experience silence.


Examples

See how to use Amazon Polly voices on the SignalWire platform.

Use the languages SWML method to set one or more voices for an AI agent.

# Install: python -m pip install signalwire-sdk==3.4.1
# Save as polly_ai_agent.py and run: python polly_ai_agent.py
from signalwire import SWMLBuilder, SWMLService
service = SWMLService(
name="polly-ai-agent",
route="/swml",
port=3000,
basic_auth=("signalwire", "<YOUR_BASIC_AUTH_PASSWORD>"),
)
SWMLBuilder(service).ai(
prompt_text="Have an open-ended conversation about flowers.",
languages=[{
"name": "English",
"code": "en-US",
"voice": "amazon.Ruth:neural",
}],
)
service.serve()

Alternatively, use the say_voice parameter of the play SWML method to select a voice for basic TTS.

# Install: python -m pip install signalwire-sdk==3.4.1
# Save as polly_tts.py and run: python polly_tts.py
from signalwire import SWMLBuilder, SWMLService
service = SWMLService(
name="polly-tts",
route="/swml",
port=3000,
basic_auth=("signalwire", "<YOUR_BASIC_AUTH_PASSWORD>"),
)
builder = SWMLBuilder(service)
builder.set(say_voice="amazon.Ruth:neural")
builder.play(url="say:Greetings. This is the Ruth voice from Amazon Polly's Neural text-to-speech model.")
service.serve()

The Server SDKs build each document and serve it at /swml on port 3000. The server answers only requests that carry the username signalwire and the password you set in place of <YOUR_BASIC_AUTH_PASSWORD>. To send calls from your phone number to the server, follow Answer a call via SWML.