Overview
Amazon Polly is an AI voice generator that provides high-quality, natural-sounding human voices in multiple languages. With LiveKit's Amazon Polly integration and the Agents framework, you can build voice AI applications that sound realistic.
Quick reference
This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.
Installation
Install the plugin from PyPI:
pip install "livekit-agents[aws]~=1.0rc"
Authentication
The Amazon Polly plugin requires an AWS API key.
Set the following environment variables in your .env
file:
AWS_ACCESS_KEY_ID=<aws-access-key-id>AWS_SECRET_ACCESS_KEY=<aws-secret-access-key>AWS_DEFAULT_REGION=<aws-deployment-region>
Usage
Use an Amazon Polly TTS within an AgentSession
or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.
from livekit.plugins import awssession = AgentSession(tts=aws.TTS(voice="Ruth",speech_engine="generative",language="en-US",),# ... llm, stt, etc.)
Parameters
This section describes some of the parameters. See the plugin reference for a complete list of all available parameters.
Voice to use for the synthesis. For a full list, see Available voices.
Language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN). To learn more, see Languages in Amazon Polly.
The voice engine to use for the synthesis. Valid values are standard
, neural
, long-form
, and generative
. To learn more, see Amazon Polly voice engines.
Controlling speech and pronunciation
Amazon Polly supports Speech Synthesis Markup Language (SSML) for customizing generated speech. To learn more, see Generating speech from SSML docs and Supported SSML tags.
Additional resources
The following resources provide more information about using Amazon Polly with LiveKit Agents.
Python package
The livekit-plugins-aws
package on PyPI.
Plugin reference
Reference for the Amazon Polly TTS plugin.
GitHub repo
View the source or contribute to the LiveKit Amazon Polly TTS plugin.
AWS docs
Amazon Polly's full docs site.
Voice AI quickstart
Get started with LiveKit Agents and Amazon Polly.