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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@lumiastream/wakeword

v1.1.2

Published

A wake word detection library using Vosk and SoX for real-time voice recognition.

Readme

LumiaWakeWord

A wake word detection library using Vosk and SoX for real-time voice recognition.

Features

  • Real-time wake word detection
  • Multi-platform support (Windows, macOS, Linux)
  • Audio device selection (especially useful for Windows)
  • Confidence threshold filtering
  • Dynamic grammar updates

Installation

npm install @lumiastream/wakeword

Quick Start

import { startWakeWord, listAudioDevices } from "@lumiastream/wakeword";

// List available audio devices
const devices = await listAudioDevices();
console.log("Available devices:", devices);

// Start wake word detection
const wakeWord = startWakeWord({
  grammar: ["hello", "lumia", "computer"],
  confidence: 0.7,
  device: "0" // Optional: specify audio device
});

// Handle detections
wakeWord.stdout.on("data", (data) => {
  const lines = data.toString().split("\n");
  for (const line of lines) {
    if (line.startsWith("voice|")) {
      const word = line.split("|")[1];
      console.log(`Wake word detected: ${word}`);
    }
  }
});

Audio Device Selection

Windows Users

Windows users often need to select the correct audio input device. Use these commands to find and test devices:

# List all available audio devices
npm run list-devices

# Interactive device testing
npm run test-devices

# Use a specific device
AUDIO_DEVICE=1 npm start

Setting the Audio Device

Method 1: Environment Variable

set AUDIO_DEVICE=1
npm start

Method 2: Programmatically

startWakeWord({
  device: "1",
  grammar: ["hello", "lumia"]
});

See AUDIO_DEVICES.md for detailed device configuration guide.

API Reference

listAudioDevices()

Returns a Promise that resolves to an array of available audio devices.

const devices = await listAudioDevices();
// Returns: [{ id: "0", name: "Microphone (Realtek)" }, ...]

startWakeWord(options)

Starts the wake word detection process.

Options:

  • device (string): Audio device ID to use
  • soxPath (string): Path to SoX binary (optional)
  • sampleRate (number): Sample rate, default 16000
  • grammar (string[]): Array of wake words to detect
  • confidence (number): Confidence threshold (0-1), default 0.7

Returns: ChildProcess instance

Scripts

npm run list-devices    # List available audio devices
npm run test-devices    # Interactive device testing
npm start              # Start wake word detection

Example

Run the included example:

node example.js

Dependencies

  • Vosk - Speech recognition toolkit
  • SoX - Sound processing tool
  • Vosk model included: vosk-model-small-en-us-0.15

Platform Notes

Windows

  • Default uses device "0" if not specified
  • Use npm run test-devices to find the correct device
  • USB microphones may appear as separate devices

macOS/Linux

  • Uses system default audio input automatically
  • Device selection usually not needed

Troubleshooting

  1. No audio detected on Windows:

    • Run npm run test-devices to find the correct device
    • Set AUDIO_DEVICE environment variable
  2. Poor recognition quality:

    • Adjust confidence threshold (lower = more sensitive)
    • Try different audio devices
    • Ensure microphone is not muted
  3. Device not found:

    • Ensure microphone is connected before starting
    • Check system audio settings

SoX Binaries

Pre-compiled SoX binaries are included for all platforms. Source: https://github.com/zackees/static-sox/tree/main/bin

License

See LICENSE file for details.