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

mellon

v0.0.26

Published

Offline, in-browser voice commands powered by EfficientWord-Net (ResNet-50 ArcFace).

Readme

What's the elvish word for "friend" ?

Mellon

Offline, fully in-browser hotword / wake-word detection powered by EfficientWord-Net (ResNet-50 ArcFace).

  • 100% offline — ONNX inference runs in the browser via WebAssembly; no server, no cloud.
  • Speaker-independent — the model generalises across voices out of the box.
  • Custom words — enroll any phrase with ≥ 3 audio samples.
  • TypeScript-ready — ships with full .d.ts declarations.

Table of contents

  1. Installation
  2. Quick start
  3. Enrolling words
  4. API reference
  5. Science behind the lib

Installation

npm install mellon

Quick start

import { Detector } from 'mellon'

const hotWordDetection = new Detector([
  {
    name: 'openDoors',
    triggers: [{ name: 'mellon', defaultRefPath: '/mellon-assets/mellon_ref.json' }],
    onMatch: () => console.log('opening the doors...')
  },
  {
    name: 'startEngine',
    triggers: [
      { name: 'start', defaultRefPath: '/mellon-assets/start_ref.json' },
      { name: 'go', defaultRefPath: '/mellon-assets/go_ref.json' }
    ],
    onMatch: (triggerNameMatched, confidence) => {
      console.log({ triggerNameMatched, confidence })
      console.log('starting engine...')
    }
  },
  {
    name: 'stopEngine',
    triggers: [
      { name: 'stop', defaultRefPath: '/mellon-assets/stop_ref.json' },
      { name: 'wait', defaultRefPath: '/mellon-assets/wait_ref.json' }
    ],
    onMatch: (triggerNameMatched, confidence) => {
      console.log({ triggerNameMatched, confidence })
      console.log('stopping engine...')
    }
  }
])

await hotWordDetection.start() // opens the mic and listens for all registered triggers

Enrolling custom words

import { Detector, EnrollmentSession, Storage } from 'mellon'

const hotwordDetection = new Detector([{
  name: 'startEngine',
  triggers: [{ name: 'start' }],
  onMatch: (triggerNameMatched, confidence) => { console.log('starting engine...') }
}])


// 1. Create an enrollment session
const session = new EnrollmentSession('start')

// 2. Record at least 3 samples (1.5 s each)
await session.recordSample()
await session.recordSample()
await session.recordSample()

// Optionally remove a bad take (0-based index)
// session.deleteSample(1)

// 3. Generate reference embeddings
const ref = await session.generateRef()

// 4a. Use immediately in the running detector
hotwordDetection.addCustomWord(ref)
await hotwordDetection.start()

// 4b. Persist for future sessions
Storage.saveWord(ref)

API reference

Detector

The easiest way to use the library. Wraps mic access, AudioWorklet wiring, and detector management into a single class.

class Detector {
  constructor(commands: Command[], config?: MellonConfig)
  readonly threshold:  number   // read/write; persisted in localStorage
  readonly listening:  boolean

  init(): Promise<void>
  start(): Promise<void>
  stop(): Promise<void>
  addCustomWord(ref: WordRef): void

  // Storage helpers — static, work without a Detector instance
  static loadWords(storageKey?: string): WordRef[]
  static saveWord(ref: WordRef, storageKey?: string): void
  static deleteWord(wordName: string, storageKey?: string): void
}

Storage

Static helpers for persisting enrolled word references in localStorage.

class Storage {
  static loadWords(storageKey?: string): WordRef[]
  static saveWord(ref: WordRef, storageKey?: string): void
  static deleteWord(wordName: string, storageKey?: string): void
}

EnrollmentSession

Records audio samples from the mic (or uploaded files) and generates reference embeddings for a new custom word.

class EnrollmentSession {
  constructor(wordName: string, config?: EnrollmentSessionConfig)

  recordSample():                 Promise<number>    // records 1.5 s; returns new sample count
  deleteSample(index: number):    number             // removes sample at index; returns new count
  generateRef():                  Promise<WordRef>   // requires ≥ 3 samples
}

WordRef shape

interface WordRef {
  word_name:   string           // e.g. 'hello'
  model_type?: string
  embeddings:  number[][]       // N × 256 vectors
}

Compatible with the EfficientWord-Net _ref.json format — you can import reference files generated by the Python toolkit directly.


Science behind the lib

Check out this paper.

License

MIT