Forked from NamasteProgrammingYouTube/speech-synth.js
Last active
July 27, 2020 09:52
-
-
Save vashisth00/c5f02b71afb539e490509d83b30410de 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: "ogg", | |
VoiceId: "Alex", | |
LanguageCode: "es-ES" | |
} | |
Polly.synthesizeSpeech(input, (err, data) => { | |
if (err) { | |
console.log(err) | |
return | |
} | |
if (data.AudioStream instanceof Buffer) { | |
fs.writeFile('hello.ogg', 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