Amazon Polly – Text-to-Speech

Turn text into lifelike speech using deep learning

Amazon Polly supports dozens of languages and a wide selection of natural-sounding male and female voices. When you send text to Amazon Polly's API, it returns the audio to your application as a stream so you can play the voices immediately. Amazon Polly also supports lexicons and SSML tags which enable you to control aspects of speech, such as pronunciation, volume, pitch, and speed rate,

Setup

  1. Login or Register to Admin Portal

  2. Select Functions

  3. Select your desired App and Keyset

  4. Select "Explore Templates" and proceed with selected integration.

  5. Create an account with AWS

  6. Grab the AWS_access_key and AWS_secret_key - you will need these details to complete configuration of this integration

  7. Select this template by using ‘Use Template’ button

  8. Assign the module and keyset under which the integration should run

  9. Configure AWS_secret_key and AWS_access_key

  10. Confirm the configuration

  11. Review the code and if it looks ok - start the function

Walkthrough

This PubNub Function listens for all chats and allows to get audio from text in private chats. To trigger text-to-speech conversion, event payload should contain 'polly' field in it with following keys: location - name of key in event payload, which contain data for polly voice - identifier of voice which should be used to read text. By default set to: 'Joanna' format - generated audio file format. By default set to: 'mp3'

  • location - name of key in event payload, which contain data for polly

  • voice - identifier of voice which should be used to read text. By default set to: 'Joanna'

  • format - generated audio file format. By default set to: 'mp3'

Input:

1

Output:

1

Talk to an expert