Search code examples
javascriptspeech-recognitionspeech

Speech recognition for javascript node.js


Currently, I'm working on a side project. I'm using javascript and node.js as of now. I'm trying to add voice recognition to my applications, although not in the browser. I know there's a lot of things out there that use the browser's speech recognition API, but I normally run my scripts in terminal using my mac. For example what I'm trying to achieve is something as follows. I would say something, and if this corresponds with an if statement then the script will do whatever task as requested. So if I say "Hello" it will do whatever task that does when said. Is there anything even like this?


Solution

  • There are a lot of Node modules that just wrap the browser's speech recognition if available, which is no help if you aren't in a browser. There are also several modules that are interfaces to external services that will do speech recognition for you, if you send them the audio.

    If you're looking for a module that actually does local speech recognition, instead of just farming out the problem to someone else, the only thing I could find was pocketsphinx, which, while it is a wrapper for a tool that you have to have installed (i.e. the recognizer itself isn't in JavaScript), nonetheless purportedly allows you to do local, on-device speech recognition from NodeJS, without having to worry about "pricing" or privacy.