Node.js Client for Google Cloud Speech API (Beta)
Google Cloud Speech API: Google Cloud Speech API.
Quick Start
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable the Google Cloud Speech API.
- Setup Authentication.
Installation
$ npm install --save @google-cloud/speech
Preview
SpeechClient
var speech = require('@google-cloud/speech');
var client = speech({
});
var languageCode = 'en-US';
var sampleRateHertz = 44100;
var encoding = speech.v1.types.RecognitionConfig.AudioEncoding.FLAC;
var config = {
languageCode : languageCode,
sampleRateHertz : sampleRateHertz,
encoding : encoding
};
var uri = 'gs://gapic-toolkit/hello.flac';
var audio = {
uri : uri
};
var request = {
config: config,
audio: audio
};
client.recognize(request).then(function(responses) {
var response = responses[0];
})
.catch(function(err) {
console.error(err);
});
Next Steps