Text-to-Speech Narrator on AWS
Description about the project : Built a serverless application that converts uploaded text files into speech using Amazon Polly .
Things to do in Project:
Step 1: Choose a text, article or newsletter to be translated from text to speech
Step2 : A lambda function to retrieve the text and send it to Amazon Polly for synthesis
Step3 : Choose the required language and a voice model provided. Amazon Polly converts the text to speech and sends it to AWS lambda
Step4 : The AWS lambda function stores this audio file retrieved from Polly in Simple Storage Service (S3)
Step5 : The S3 Bucket consists of the final text to speech audio.
The Architecture of this project will be like this
Services used in this project:
- AWS lambda
- AWS Polly
- S3
- IAM
- CloudWatch
View lambda Function on github : (https://github.com/bilsgotchills/Text-to-Speech-Narrator-on-Aws.git)
How to implement this project :
Step 1: Prerequisties
- AWS account
- IAM user with permission for Lambda , S3 , Polly
- AWS cli (optional)
- Naming it "awspolly-bucket-bils"
- Note the Bucket name
- Add the bucket permission so that we can check the speech in it
- Runtime will be Node.js 20.x
- Assign the IAM role you just created
- Add the sample code
- Deploy the function
- Run a test event
- Check your S3 Bucket -- you should see output.mp3
- Event type : ALL object create events or (at least PUT)
- Suffix filter : .txt
- Destination : your lambda name or ARN of lambda
Step2: Add invoke function in Lambda
- In lambda console open your function - Configuration - Permission - ResourceBasedPolicy - Add permission
- Service: Select S3
- Principal - S3
- Action - Lambda:InvokeFunction
- StatementID: give a unique name
- Source Account: your account ID
- Bucket ARN : paste your bucket ARN
- Now S3 is allowed to invoke your Lambda
- Upload a .txt file in S3
- Lambda will read the file content's , send it to Polly , and save the audio to your bucket (you can use the same bucket for output and input or a different bucket for both )
Comments
Post a Comment