Get Instant Solutions for Kubernetes, Databases, Docker and more
AWS Polly is a service provided by Amazon Web Services that turns text into lifelike speech. It allows developers to create applications that can talk, making it a powerful tool for creating interactive voice applications, accessibility solutions, and more. Polly supports a variety of languages and voices, offering flexibility and customization for different use cases.
When using AWS Polly, you might encounter the InvalidSampleRateException
. This error typically occurs during the synthesis process, where the specified sample rate does not match the requirements of the chosen output format. As a result, the synthesis request fails, and no audio output is generated.
The InvalidSampleRateException
is an error that indicates a mismatch between the sample rate provided in your request and the supported sample rates for the output format you have selected. AWS Polly supports different sample rates for different output formats, such as MP3, OGG, and PCM. Providing an unsupported sample rate will trigger this exception.
To resolve this issue, follow these steps:
Check the AWS Polly documentation to ensure that the sample rate you are using is supported for the output format you have chosen. You can find the supported sample rates for each format in the AWS Polly API Reference.
Modify your request to use a valid sample rate. For example, if you are using the MP3 format, ensure that your sample rate is one of the supported values such as 8000, 16000, or 22050 Hz.
{
"OutputFormat": "mp3",
"SampleRate": "16000",
"Text": "Hello, world!",
"VoiceId": "Joanna"
}
After adjusting the sample rate, test your configuration by sending a new synthesis request. Ensure that the request is successful and that the audio output is generated as expected.
By ensuring that the sample rate matches the supported values for your chosen output format, you can effectively resolve the InvalidSampleRateException
in AWS Polly. For further assistance, refer to the AWS Polly Documentation or reach out to AWS Support.
(Perfect for DevOps & SREs)
(Perfect for DevOps & SREs)