Amazon Polly
The amazon_polly
text-to-speech platform that works with Amazon Polly to create the spoken output.
Polly is a paid service via Amazon Web Services. There is a free tier for the first 12 months and then a charge per million characters afterwards.
Setup
For more information, please read the AWS General Reference regarding Security Credentials to get the needed details. Also, check the boto3 Documentation about the profiles and the AWS Regions and Endpoints Reference for available regions.
Available voices are listed in the Amazon Documentation.
Configuration
To get started, add the following lines to your configuration.yaml
(example for Amazon Polly):
# Example configuration.yaml entry
tts:
- platform: amazon_polly
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
Configuration Variables
Your AWS Access Key ID. If provided, you must also provide an aws_secret_access_key
and must not provide a profile_name
.
Your AWS Secret Access Key. If provided, you must also provide an aws_access_key_id
and must not provide a profile_name
.
A credentials profile name. If provided, you must not provide an aws_access_key_id
nor an aws_secrete_access_key
.
Whether to interpret messages as text
or as ssml
by default.
The Voice Name/ID to be used for generated speech by default.
Override the default output format. Either mp3
, ogg_vorbis
or pcm
.
Override the default sample rate. Possible values are: 8000, 16000, 22050, 24000.
22050 for MP3 and Ogg Vorbis, 16000 for pcm
Usage
Say to all media_player
device entities:
- service: tts.amazon_polly_say
data:
message: "<speak>Hello from Amazon Polly</speak>"
or
- service: tts.amazon_polly_say
data:
message: >
<speak>
Hello from Amazon Polly
</speak>
Say to the media_player.living_room
device entity:
- service: tts.amazon_polly_say
target:
entity_id: media_player.living_room
message: >
<speak>
Hello from Amazon Polly
</speak>
Say with break:
- service: tts.amazon_polly_say
data:
message: >
<speak>
Hello from
<break time=".9s" />
Amazon Polly
</speak>