nuance-nodejs
A simple Nuance HTTP Client for NodeJS.
Installation
Use NPM:
npm install nuance --save
##Usage
First, you need to create a new Nuance instance:
var Nuance = require("nuance");
var nuance = new Nuance(appID, appKey);
If you'd like to send a Text-To-Speech request, use the method sendTTSRequest as follow:
nuance.sendTTSRequest({
"text": "hello world",
"output": "testFile.wav",
"outputFormat": "wav",
"language": "en_US",
"voice": "Tom",
"identifier": "randomIdentifierStringHere",
"success": function(){
console.log("The file was saved.");
},
"error": function(response){
console.log("An error was occurred");
console.log(response);
}
});
If you'd like to send a Dictation request (Speech-To-Text), use the method sendDictationRequest as follow:
nuance.sendDictationRequest({
"identifier": "randomIdentifierStringHere",
"language": "en-US",
"path": "audio.amr",
"additionalHeaders": {},
"success": function(resp){
console.log(resp);
},
"error": function(resp){
console.log("An error was occurred.");
console.log(resp);
}
});
##Notes
- If you receive error 500 with AUDIO_INFO - the headers you sent are probably wrong.
- Please make sure you are sending the right headers with the right language.
- Feel free to modify the default dictationHeaders in the nuance.js file, at the moment they are set to handle AMR files.
- You may also replace the default dictationHeaders by suppling additionalHeaders in the sendDictationRequest options, so you don't have to change the default headers in the nuance.js file.