Created
January 15, 2020 19:04
-
-
Save NamasteProgrammingYouTube/b0d136917ab708f26c6214619ca2c145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const fs = require('fs') | |
const Polly = new AWS.Polly({ | |
region: 'ap-south-1' | |
}) | |
const input = { | |
Text: "Hola, Buenas dias.", | |
OutputFormat: "mp3", | |
VoiceId: "Mia", | |
LanguageCode: "es-ES" | |
} | |
Polly.synthesizeSpeech(input, (err, data) => { | |
if (err) { | |
console.log(err) | |
return | |
} | |
if (data.AudioStream instanceof Buffer) { | |
fs.writeFile('hello.mp3', data.AudioStream, (fsErr) => { | |
if (fsErr) { | |
console.error(fsErr) | |
return | |
} | |
console.log('Success') | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I want to upload a output file in my s3 bucket, so please let me know where may i need to update on code. Thanks