How to use the google-proto-files.speech function in google-proto-files

To help you get started, we’ve selected a few google-proto-files examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-speech / samples / recognize_streaming.js View on Github external
'use strict';

var async = require('async');
var fs = require('fs');
var path = require('path');
var grpc = require('grpc');
var googleProtoFiles = require('google-proto-files');
var googleAuth = require('google-auto-auth');
var Transform = require('stream').Transform;

// [START proto]
var PROTO_ROOT_DIR = googleProtoFiles('..');

var protoDescriptor = grpc.load({
  root: PROTO_ROOT_DIR,
  file: path.relative(PROTO_ROOT_DIR, googleProtoFiles.speech.v1beta1)
}, 'proto', {
  binaryAsBase64: true,
  convertFieldsToCamelCase: true
});
var speechProto = protoDescriptor.google.cloud.speech.v1beta1;
// [END proto]

// [START authenticating]
function getSpeechService (host, callback) {
  var googleAuthClient = googleAuth({
    scopes: [
      'https://www.googleapis.com/auth/cloud-platform'
    ]
  });

  googleAuthClient.getAuthClient(function (err, authClient) {
github TheAdrianProject / AdrianSmartAssistant / Library / googleSpeech / stream.js View on Github external
var fs = require('fs');
var cursor = ansi(process.stdout);

//Lets require/import the HTTP module
var http = require('http');
var url = require("url");

//Lets define a port we want to listen to
const PORT=9950;

// [START proto]
var PROTO_ROOT_DIR = googleProtoFiles('..');
var mic = null;
var protoDescriptor = grpc.load({
      root: PROTO_ROOT_DIR,
      file: path.relative(PROTO_ROOT_DIR, googleProtoFiles.speech.v1beta1)
    }, 'proto', {
      binaryAsBase64: true,
      convertFieldsToCamelCase: true
    });

var speechProto = protoDescriptor.google.cloud.speech.v1beta1;
// [END proto]

//We need a function which handles requests and send response
function handleRequest(request, response){

    var method = url.parse(request.url).query;

    if (method=="startListening"){

        //var reqestCommand = "GOOGLE SPEACH DEAMON : Start Recognition";
github jakkra / SmartMirror / speech / stream.js View on Github external
var async = require('async');
var fs = require('fs');
var path = require('path');
var grpc = require('grpc');
var googleProtoFiles = require('google-proto-files');
var googleAuth = require('google-auto-auth');
var Transform = require('stream').Transform;
var record = require('node-record-lpcm16');

const config = require('../config');

var PROTO_ROOT_DIR = googleProtoFiles('..');
var protoDescriptor = grpc.load(
  {
    root: PROTO_ROOT_DIR,
    file: path.relative(PROTO_ROOT_DIR, googleProtoFiles.speech.v1),
  },
  'proto',
  {
    binaryAsBase64: true,
    convertFieldsToCamelCase: true,
  }
);
var speechProto = protoDescriptor.google.cloud.speech.v1;
var isListening = false;
var stopTimer = null;
console.log('STARTING STREAM.js');

function getSpeechService(callback) {
  var googleAuthClient = googleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  });
github rdgms / google-speech-microphone / libs / speech.js View on Github external
getSpeechProto: () => {
		var PROTO_ROOT_DIR = googleProtoFiles('..');
		var protoDescriptor = grpc.load({
			root: PROTO_ROOT_DIR,
			file: path.relative(PROTO_ROOT_DIR, googleProtoFiles.speech.v1beta1)
		}, 'proto', {
			binaryAsBase64: true,
			convertFieldsToCamelCase: true
		});

		return protoDescriptor.google.cloud.speech.v1beta1.Speech;
	},