Package Exports
- node-witai-speech
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-witai-speech) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-witai-speech
Wit.ai speech API wrapper to extract the meaning of audio file
Install
npm install node-witai-speech [--save]
Usage
var WitSpeech = require('node-witai-speech');
// Stream the file to be sent to the wit.ai
var stream = fs.createReadStream("location to your audio file.");
// The wit.ai instance api key
var API_KEY = "ISDFWERSDFSDFSDFSDFSDFJIKM";
// The content-type for this audio stream (audio/wav, ...)
var content_type = "audio/wav";
// Its best to return a promise
var parseSpeech = new Promise((ressolve, reject) => {
// call the wit.ai api with the created stream
WitSpeech.extractSpeechIntent(API_KEY, stream, content_type,
(err, res) => {
if (err) return reject(err);
ressolve(res);
});
});
// check in the promise for the completion of call to witai
parseSpeech.then((data) => {
console.log(data);
})
.catch((err) => {
console.log(err);
})