How to use the @google-cloud/speech function in @google-cloud/speech

To help you get started, we’ve selected a few @google-cloud/speech 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 hugmanrique / AudioToText / lib / app.js View on Github external
import Speech from '@google-cloud/speech';
import fs from 'fs';
import async from 'async';

import {createOutputStream, getFilePath, getFiles} from './files';
import * as config from './config.json';

const client = Speech();
const options = config.audio;
const files = getFiles(config.path);

const stream = createOutputStream();

const start = () => {
  if (!files.length) {
    stream.close();
    return;
  }

  const filename = files.shift();
  const file = getFilePath(filename);

  debug('Recognizing ' + filename);