Created
January 14, 2016 20:30
-
-
Save abargnesi/06e548b676abd0ec8cf4 to your computer and use it in GitHub Desktop.
Using watson TTS for ruby name error.
This file contains hidden or 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
| 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