Skip to content

Instantly share code, notes, and snippets.

@evancohen

evancohen/gcs.js Secret

Created June 27, 2017 02:48
Show Gist options
  • Save evancohen/e525e9065888f295e3f8e8df5d478d5b to your computer and use it in GitHub Desktop.
Save evancohen/e525e9065888f295e3f8e8df5d478d5b to your computer and use it in GitHub Desktop.
Mac OS gRPC crash with no network
const ROOT_DIR = __dirname + '/../'
const record = require('node-record-lpcm16')
const speech = require('@google-cloud/speech')({
projectId: 'streaming-speech-sample',
keyFilename: ROOT_DIR + 'keyfile.json'
})
recording = record.start({
threshold: 0,
recordProgram: "rec",
verbose: false
})
const recognitionStream = speech.createRecognizeStream({
config: {
encoding: 'LINEAR16',
sampleRateHertz: 16000,
languageCode: "en-US"
},
singleUtterance: true,
interimResults: true,
verbose: true
})
recognitionStream.on('error', console.log)
recognitionStream.on('data', console.log)
recording.pipe(recognitionStream)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment