A very basic google speech api helper with microphone streaming to be used as base to others apps.
npm install google-speech-microphone
- Config Google cloud API
- Install Sox, this lib uses node-record-lpcm16 thats requires Sox to work,
so if you are using MacOS just type
brew install sox
, and for others debiansudo apt-get install sox libsox-fmt-all
Usage example:
var speech = require('google-speech-microphone');
speech.getSpeechService({
GOOGLE_APPLICATION_CREDENTIALS: 'location/project-auth.json',
GCLOUD_PROJECT: 'projectid'
})
.then(speechService => {
return speech.sync({ speechService });
})
.then(res => {
console.log(JSON.stringify(res));
})
.catch(err => {
console.log(err);
});