Skip to content

Instantly share code, notes, and snippets.

@NamasteProgrammingYouTube
Created January 15, 2020 19:04
Show Gist options
  • Save NamasteProgrammingYouTube/b0d136917ab708f26c6214619ca2c145 to your computer and use it in GitHub Desktop.
Save NamasteProgrammingYouTube/b0d136917ab708f26c6214619ca2c145 to your computer and use it in GitHub Desktop.
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')
})
}
})
@yadavpravesh26
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment