Skip to content

Instantly share code, notes, and snippets.

@abargnesi
Created January 14, 2016 20:30
Show Gist options
  • Select an option

  • Save abargnesi/06e548b676abd0ec8cf4 to your computer and use it in GitHub Desktop.

Select an option

Save abargnesi/06e548b676abd0ec8cf4 to your computer and use it in GitHub Desktop.
Using watson TTS for ruby name error.
var watson = require('watson-developer-cloud');
var fs = require('fs');
var exec = require('child_process').exec;
var text_to_speech = watson.text_to_speech({
username: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
password: 'xxxxxxxxxxxxxxxxx',
version: 'v1'
});
var params = {
text: '<p><s><prosody rate=\'slow\'>name error</prosody> on 43<break time=\'0.25s\'/>7.</s></p>',
voice: 'en-US_AllisonVoice', // Optional voice
accept: 'audio/wav'
};
// Pipe the synthesized text to a file
synth = text_to_speech.synthesize(params);
synth.pipe(fs.createWriteStream('output.wav'));
synth.on('end', () => {
exec('aplay output.wav',
function (error, stdout, stderr) {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
if (error !== null) {
console.log(`exec error: ${error}`);
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment