Giter Site home page Giter Site logo

node-speakable's Introduction

node-speakable

Description

node-speakable is a continuous speech recognition module for node.js.

Basically, node-speakable is continuous waiting for you to say something and waits until you finally stopped talking. It then emits an speechResult event with an Array() including of your recognizedWords. You can then .indexOf() the array to trigger some awesome action to happen, like turning on your Philips Hue lights.

If you ever talked to your XBOX360 (kinect) you're already familiar on how a continuous speech recognition system works for you.

How

It's pure JavaScript magic... Ok, not yet! Currently node-speakable needs you to put a binary of sox into the modules (into lib) folder to do the recording. The actual voice recognition is then achieved trough a POST to the the Google Speech API.

Setup

You'll need to ensure that you turn the Google Speech API selection to 'ON' in the API Console. If you don't see it there, you might want to check out this first: http://www.chromium.org/developers/how-tos/api-keys. For the example project, you'll also need to set the environment variable GKEY in your shell to your API key.

Example usage (node example.js)

var Speakable = require('./');

var speakable = new Speakable({key: 'your-google-API-key'});

By default, the language is American English ( 'en-US' ), but you can specify another language in the options. Example usage:

var speakable = new Speakable({key: 'your-google-API-key'}, {lang: 'it-IT'});
speakable.on('speechStart', function() {
  console.log('onSpeechStart');
});

speakable.on('speechStop', function() {
  console.log('onSpeechStop');
});

speakable.on('speechReady', function() {
  console.log('onSpeechReady');
});

speakable.on('error', function(err) {
  console.log('onError:');
  console.log(err);
  speakable.recordVoice();
});

speakable.on('speechResult', function(recognizedWords) {
  console.log('onSpeechResult:')
  console.log(recognizedWords);
  speakable.recordVoice();
});

speakable.recordVoice();

License

node-speakable is licensed under the MIT license.

Todo / Ideas

  • Limit maximum listening time

node-speakable's People

Contributors

fliegenklatsch avatar guileen avatar jamil avatar joestrong avatar paulmand3l avatar sreuter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-speakable's Issues

Does you script supposed to run on mac os 10.9

When i run the example.js

i get the error :

rec FAIL formats: no handler for given file type `flac'.

I have installed SoX from 'brew' and and I do have flac 1.2.1 installed.

I have gone though man pages at http://sox.sourceforge.net/sox.pdf but did not get the information that I am looking for.

How can I add support for .flac files?

I am on OS X 10.9.3

I have an issue when I execute example.js

C:\Users\Maxence\Desktop\node-speakable-master\node-speakable-master ([email protected])
λ node example.js
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn C:\Users\Maxence\Desktop\node-speakable-master\node-speakable-master\lib/sox ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3

Buffer overrun

I just added sox to the lib when I hit this error.

/v2.0/node_modules/speakable/lib/sox WARN coreaudio: coreaudio: unhandled buffer overrun. Data discarded.

Any idea?
Thanks!

Error Message on MacBook

I am using a Mac with the latest OS.

I downloaded the module and I put the sox binary into the lib folder. But I am continuing to get this error (in the screenshot):

screen shot 2016-02-07 at 5 41 13 pm

I havent changed the code because I have just been trying to get it to work on my machine. I also tried the same test on my Windows machine, and put the SoX windows binary instead but got the same error.

my code is here:

https://github.com/gcrev93/FrozenBot

can anyone tell me what is causing this error?

Unhandled 'error' event

On ubuntu with nodejs v0.10.25

artem@artem-desktop-bt:~/build/node-speakable$ 
node example.js 
onSpeechReady

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

Adding flac to SoX

Hi, I just ran the configure of SoX anf found out it doesn't add flac automaticly, wich you use to send to the API of google speech.

After googling for a couple of hours now I can't seem to figure out how to do this...

Could you give me any help with that please?

Thanks!

Always "onSpeachReady"

Hi! I use Ubuntu and I'm trying use this lib.

I'm using this example and the log is always "onSpeechReady".

captura de tela de 2014-05-26 22 59 12

I speak anything but nothing happens.

Any idea? My notebook is a Dell and it has a mic.

sox never quits, and therefore never posts

I am not sure if this is expected behavior or not, but it seems to me that sox never stops recording. As the data is only posted on the close event, this never happens (only when I do it manually, which works).

Speakable fails on Node.js v4.2.1 due to spawh() changes

Running speakable on Node.js v4.2.1 fails with [TypeError: options argument must be an object]. This happens when trying to spawn the sox process (node-speakable.js, line 75) due to the options argument passed being a string.

The quick fix for this is to change that line to

var rec = spawn(self.cmd, self.cmdArgs, {stdio:'pipe'});

I haven't tested this change on Node.js v0.12.x though.

Can't install from npm

npm install --save speakable

yields

npm http GET https://registry.npmjs.org/speakable
npm http 304 https://registry.npmjs.org/speakable
npm http GET https://registry.npmjs.org/speakable/-/speakable-0.2.0.tgz
npm http 404 https://registry.npmjs.org/speakable/-/speakable-0.2.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/speakable/-/speakable-0.2.0.tgz
npm ERR! Error: 404 Not Found
npm ERR! at WriteStream. (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:57:12)
npm ERR! at WriteStream.EventEmitter.emit (events.js:117:20)
npm ERR! at fs.js:1598:14
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:105:5
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--save" "speakable"
npm ERR! cwd /Users/paulmandel/Code/github/lue
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/paulmandel/Code/github/lue/npm-debug.log
npm ERR! not ok code 0

Broken on Windows??

I can't get this to work at all using Win32 binaries. Throws an interesting error, and debugging shows the array of arguments is keeping its commas. Separating them out into a string however just causes another colorful error, "Incorrect value of args option" which I can't even figure out what's going on.

Also, it seems to be really difficult to find sox binaries for Linux, so I can't test on linux :(

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.