Giter Site home page Giter Site logo

node-google-speech-api's Introduction

Google Speech API

Build Status

Google Speech API wrapper for node. It requires ffmpeg compiled with flac support in order to work.

1.0.0 Update

Switched from SoX to ffmpeg. Make sure you have at least version 0.9 of ffmpeg.

0.5 Update

The google speech api now requires an API Key. You'll have to create an app in the Google Developers Console and enable the speech api.

To enable the speech api in the developer console you must join the chromium dev-list in google groups. See these comments for more details.

The response format has also changed. Instead of returning utterances, google now returns alternatives with a transcript. See the example below.

Usage

var speech = require('google-speech-api');

var opts = {
  file: 'speech.mp3',
  key: '<Google API Key>'
};

speech(opts, function (err, results) {
  console.log(results);
  // [{result: [{alternative: [{transcript: '...'}]}]}]
});

Piping

You can pipe data:

var request = require('superagent');
var speech = require('google-speech-api');

// must specify the filetype when piping
var opts = {filetype: 'mp3'};

request
  .get('http://../../file.mp3')
  .pipe(speech(opts, function (err, results) {
    // handle the results
  }));

Options

You can specify several options:

  • clipSize — The audio duration of files sent to google (in seconds.) Larger files will be broken into pieces. (defaults to 15)
  • file — The audio file. May be a string path or a Buffer object. (required)
  • key — Your google API key. (required)
  • client — The name of the client you are connecting with. (defaults to "chromium")
  • filetype — Specify the file type. Required when piping or if the file is a buffer object.
  • lang — The spoken language in the file. (defaults to "en-US")
  • maxRequests — The maximum number of clips to send to google at a time. (defaults to 4)
  • maxResults — The maximum number of hypotheses returned by google. (defaults to 1)
  • pfilter — Filter profanity by replacing flagged words with pound symbols. Set 0 to unfilter. (defaults to 1)
  • sampleRate — The sample rate of the audio sent to google. (defaults to 44000)
  • timeout — The amount of time to wait for the speech API before timing out (defaults to 6000ms)

node-google-speech-api's People

Contributors

imskull avatar psirenny avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.