npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-voice-command-google

v2.1.0

Published

Recognize a single voice command on a Raspberry Pi using the Google Speech API.

Readme

pi-voice-command-google

Recognize a single voice command on a Raspberry Pi using the Google Speech API.

~~ WARNING ~~

Google demands personal information, including credit card billing information in order to use their service. Further, at time of writing, only 60 minutes of speech is free per month before you are charged. This is soooo far from a good solution, but it's the best I've been able to find for free voice recognition. To help the development of Free/Libre Open Source voice recognition, please contribute your voice to the Common Voice project!

Setup

  1. Install NodeJS 8.x.x or newer.
  2. Follow Step 1 and Step 2 on this Google Speech API quickstart page. Save the JSON file it gives you somewhere handy.
  3. Have ALSA set up for audio. If the arecord command is not available, you might need a package like alsa-utils.
  4. Run npm install pi-voice-command-google to install the module.

Usage

var voice = require('pi-voice-command-google')
var fs = require('fs')

var keysPath = './speech_keys.json'

voice(keysPath, function (err, res) {
  if (err) throw err
  console.log('Transcript:', res)
})

and saying 'hello world' aloud, outputs

hello world

API

var voice = require('pi-voice-command-google')

var cancel = voice(keysPath[, ready], cb)

Returns a function cancel that can be used to terminate microphone recording and upload to Google servers.

keysPath is a path to a JSON file: whatever Google gives you when you set up a Speech API project here.

Otherwise, cb(err, res) is called. res will be a string with the contents of what the Google machinery heard you say.

ready is optional, and is a function that will be called once the mic is set up and recording is starting.

Right now, this function is hardcoded to abort after 3 seconds of silence (no command given; null as res), or after 1 second of silence after a command is given.

License

MIT