aws-samples / aws-sdk-js-notes-app

A simple note taking application using modular AWS SDK for JavaScript (v3)
Other
81 stars 30 forks source link

Convert note text to speech using Amazon Polly #17

Closed trivikr closed 3 years ago

trivikr commented 3 years ago

Is your feature request related to a problem? Please describe.

The real-time audio transcription using Amazon Transcribe was added in https://github.com/aws-samples/aws-sdk-js-notes-app/pull/7 It's not a problem, but it would be good to have an example of converting text to speech using Amazon Polly.

Getting Started Developer Guide for AWS SDK for JavaScript (v3) contains an example of using Amazon Polly in the frontend.

Describe the solution you'd like

Ability to read notes using text to speech with Amazon Polly.

trivikr commented 3 years ago

Rather than creating a synthesized speech URL, it would be interesting if the app plays the stream of audio. Amazon Polly documentation https://aws.amazon.com/polly/features/

trivikr commented 3 years ago

As per this StackOverflow discussion, the srcObject of HTMLMediaElement can be overwritten. It's also mentioned in MDN at HTMLMediaElement.srcObject

However, TypeScript is throwing error Invalid left-hand side in assignment expression when it's tried with useRef. Experimental commit: https://github.com/trivikr/aws-sdk-js-notes-app/commit/42aa17047714a102a45c6ae04721e56a5a481b17