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 🙏

© 2024 – Pkg Stats / Ryan Hefner

bumblebee-hotword-node

v0.2.1

Published

Bumblebee Hotword for NodeJS

Downloads

458

Readme

Bumblebee Hotword for NodeJS

screenshot

Bumblebee Hotword starts recording the system microphone and emits an event when it hears the available hotwords.

This is a stripped down and repackaged version of the excellent Porcupine wake word (hotword) system. This requires no cloud services and is freely available to use under the Apache 2.0 license (GPLv3 compatible).

This is the NodeJS version of Bumblebee Hotword. If you need hotword detection in the browser or ElectronJS see here.

Hotword detection is just one part of the larger Bumblebee voice application framework, for more information see:

Install

Using npm:

npm install bumblebee-hotword-node

Quick Start

const Bumblebee = require('bumblebee-hotword-node');
const bumblebee = new Bumblebee();

bumblebee.addHotword('bumblebee');

bumblebee.on('hotword', function (hotword) {
	console.log('Hotword Detected:', hotword);
});

bumblebee.start();

Hotwords

The hotwords available by default are:

  • alexa
  • computer
  • bumblebee
  • grasshopper
  • hey_edison
  • hey_google
  • hey_siri
  • jarvis
  • ok google
  • porcupine
  • terminator

These hotwords are build into the NPM package but must be added to Bumblebee individually. For performance it is recommended to only add the hotwords that are needed:

bumblebee.addHotword('alexa');
bumblebee.addHotword('computer');
bumblebee.addHotword('bumblebee');
bumblebee.addHotword('grasshopper');
bumblebee.addHotword('hey_edison');
bumblebee.addHotword('hey_google');
bumblebee.addHotword('hey_siri');
bumblebee.addHotword('jarvis');
bumblebee.addHotword('ok_google');
bumblebee.addHotword('porcupine');
bumblebee.addHotword('terminator');

The hotword that is detected can be retreived in the .on('hotword') event:

bumblebee.on('hotword', function(hotword) {
	console.log('hotword detected:', hotword);
});

To only receive a hotword event for one of the hotwords, use the setHotword() method:

bumblebee.setHotword('hey_edison');

The Picovoice hotwords open source hotwords are freely usable under the Apache 2.0 license. Custom hotwords can be licensed from https://picovoice.ai.

Add New Hotwords

The default hotwords were open sourced and supplied by Picovoice.

To convert a PPN hotword file to the formate used by Bumblebee, use the xdd command:

xxd -i -g 1 white\ smoke_wasm.ppn output.hex

Then take byte array contents of output.hex:

unsigned char americano_wasm_ppn[] = {
    /* COPY THE CONTENTS HERE */
};
unsigned int americano_wasm_ppn_len = 3008;

And create a new hotword JavaScript file with the format:

module.exports = new Uint8Array([
    /* PASTE THE CONTENTS HERE */
]);

Add the hotword file to Bumblebee Hotword using;

bumblebee.addHotword('white_smoke', require('./white_smoke.js'));

See the full example

Sensitivity

Hotword detection sensitivity (0.0 to 1.0) is configurable only before the first call to bumblebee.start()

bumblebee.setSensitivity(0.8);

Disable Bumblebee

Use the stop() method to disable the microphone and all processing:

bumblebee.stop();

Audio Data

Bumblebee Hotword records audio from the microphone in 16bit/16khz PCM format and emits a stream of "data" events so the audio can be processed by other systems (such as DeepSpeech):

bumblebee.on('data', function(data) {
	console.log('data', data);
});

Audio Stream

Instead of using the system microphone, an audio stream can be supplied. The audio format must be a Float32Array (32 bit signed floating point values) at 16Khz sample rate. Refer to the wav-example example.

// some audioInputStream object (eg. ffmpeg)

bumblebee.start({stream: audioInputStream});

Run Examples Locally

Clone this repo, then...

For the basic example:

cd examples/basic-example
node start.js

For the full example:

cd examples/full-example
npm install --mpg123-backend=openal
node start.js

For the wav file stream example:

cd examples/wav-example
npm install fluent-ffmpeg
node start.js

License

This repository is licensed under Apache 2.0. See Porcupine for more details.

Change Log

  • v0.2.1: added "Ok Google" hotword
  • v0.2.0: upgrade to Porcupine v1.9, added new hotwords
  • v0.1.1: added device path option to be sent to sox/rec
  • v0.1.0: fixed sox path for Ubuntu/Linux