Page updated Jan 16, 2024


Set up the backend

If you haven't already done so, run amplify init inside your project and then amplify add auth (we recommend selecting the default configuration).

Run amplify add predictions and select Convert. Then use the following answers:

1? What would you like to convert? (Use arrow keys)
2 Translate text into a different language
3> Generate speech audio from text
4 Transcribe text from audio
6? Who should have access? Auth and Guest users

Now run amplify push which will generate your aws-exports.js and create resources in the cloud. You can now either add this to your backend or skip and add more features to your app.

Services used: Amazon Polly

Working with the API

Generate an audio buffer for playback from a text input.

2 textToSpeech: {
3 source: {
4 text: textToGenerateSpeech
5 },
6 voiceId: "Amy" // default configured on aws-exports.js
7 // list of different options are here
8 }
10.then(result => console.log({ result }))
11.catch(err => console.log({ err }));