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

v0.2.1

Published

A minimalist hotword / wake word for the web, based on Porcupine

Downloads

134

Readme

screenshot

Bumblebee Hotword

Bumblebee Hotword 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).

When Bumblebee Hotword is added to a web page, it listens to the microphone and emits an event when it hears any of the available hotwords.

For more information about the Bumblebee platform and its other features visit:

NodeJS Version

If you need hotword detection in NodeJS use bumblebee-hotword-node.

Examples

Install

Using npm:

npm install bumblebee-hotword

And include in your web project:

import Bumblebee from "bumblebee-hotword";

Porcupine Web Assembly Codebase

The porcupine webworker files must be manually served from your public html directory and the location must be specified using setWorkersPath() before starting bumblebee.

bumblebee.setWorkersPath('/bumblebee-workers');

Copy the entire directory here to your web server's public html or assets directory.

Quick Start

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

let bumblebee = new Bumblebee();

// set path to worker files
bumblebee.setWorkersPath('/bumblebee-workers');

// add hotword
bumblebee.addHotword('bumblebee');

// set sensitivity from 0.0 to 1.0
bumblebee.setSensitivity(0.5);

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

bumblebee.start();

Note: browsers require user-interaction to start the microphone.

Hotwords

The hotwords available by default are:

  • alexa
  • bumblebee
  • computer
  • grasshopper
  • hey edison
  • hey google
  • hey siri
  • jarvis
  • ok google
  • porcupine
  • terminator

Due to processing time it is recommended to only add the hotwords that need to be used. The hotword spoken can be retreived in the .on('hotword') event:

bumblebee.addHotword('bumblebee');
bumblebee.addHotword('grasshopper');
bumblebee.addHotword('hey_edison');
bumblebee.addHotword('porcupine');
bumblebee.addHotword('terminator');

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

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

Adding a Custom Hotword

Like the open source hotwords, the file must be in Porcupine's "_wasm.ppn" format.

You can use the tools/convert_ppn.sh shell script (uses the xdd command line program) to convert the PPN file to a JavaScript file:

sh tools/convert_ppn.sh my_custom_hotword_wasm.ppn

The resulting .js file can then be added to Bumblebee:

import my_custom_hotword from './my_custom_hotword'
bumblebee.addHotword('my_custom_hotword', my_custom_hotword, 0.5)

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();

Mute

bumblebee.setMuted(true); // mutes microphone volume

Set Microphone Volume

bumblebee.setMicVolume(0.5); // sets microphone volume to 50%
bumblebee.setMicVolume(2); // sets microphone volume to 200%

Spectrum Analyzer

Bumblebee Hotword instantiates an audio analyser which can be used to draw an oscilloscope or other types of processing:

bumblebee.on('analyser', function(analyser) {
	// analyser is an instance of audioContext.createAnalyser()
});

Audio Data

Bumblebee Hotword emits a stream of "data" events which can be used to receive the microphone audio data after downsampling to 16bit/16khz PCM. This is the format also used by other speech processing systems such as DeepSpeech.

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

Run Examples Locally

Clone this repo, then...

For the basic example:

cd examples/basic-example
yarn install
yarn start

For the full example:

cd examples/full-example
yarn install
yarn start

License

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

Change Log

0.2.1:

  • add "ok google" hotword

0.2.0:

  • upgrade to Porcupine v1.9
  • added new Porcupine hotwords: computer, alexa, hey google, hey siri, jarvis

0.1.0:

  • add microphone selection