Blog Detail

Speaking Texts...!

Left Image
Deval Ganatra
July 03, 2020

In today's world, there are so many sources available to convert text files into audio ones. I will show you one way to it using Amazon Web Services. You just require a little bit of knowledge to AWS and Done! Also, if you know Python then you can also tweak the code and explore the things.

Here is a step by step tutorial to convert Text file into Audio files.

This will a demonstration of Amazon Polly which converts your given text file into Speech. Strange thing is that it is almost free. Amazon doen’t charges you to first 1 million words.

Just follow steps and I will guide you to that.

Prerequisites

  • Little knowledge of AWS.
  • Enthusiasm to learn.

Input

  • text: Just write some paragraph of whatever length.
  • Create one S3 bucket. (Give Amazon Polly permission to write in S3)(AWS Doc)
  • Select your favourite voice for given language as input. (Voice List )

Steps to run

  1. Install boto3
  2. pip install boto3

  3. Install AWS CLI and configure credentials
  4. aws configure

    OR

    put below code into ~/.aws/credentials

    [default]

    aws_access_key_id = YOUR_ACCESS_KEY

    aws_secret_access_key = YOUR_SECRET_KEY

    region=us-east-1

  5. Create S3 bucket and Create Role for Polly AWS Doc
  6. Clone https://github.com/ganatradeval/AmazonPolly.git.
  7. Specify variables in polly.py file.
  8. Run following.
  9. cd AmazonPolly

    python polly.py