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

stark-speech

v1.0.7

Published

Easy to integrate speech functions for browsers.

Readme

Stark-speech

NPM version

Easy to integrate speech functions for browsers.

Install

npm i stark-speech

Your page depends on the hotword detection model, that has three assets. They load via HTTP at runtime and need to be copied to your project.

The assets are called:

{base_url}/model.json
{base_url}/metadata.json
{base_url}/weights.bin

An example model is here. The example verbally responds to "Stark" and, by coincidence, "Jarvis". Other models can be trained on the TeachableMachine site.

API Reference

1. Initialize

import StarkSpeech from 'stark-speech';

async function Main () {
  let starkSpeech = StarkSpeech.init(
    1e3, // Default = 8e2  Wait time before returning a result.
    "https://myWebpage.org", // Default = Current address { location.href } Base URL where the hotword model is located.
    0.9, // Default = 0.93 Accuracy of prediction for hotword detection.
    0.5, // Default = 0.75 Inverse times hotword is checked per second. 1/0.5 = 2 times/second.
  );
}
Main();

This library follows the singleton pattern due to issues with re-use of the microphone. Subsequent calls to StarkSpeech.init() will return the first instance and the new arguments are ignored.

2. API Reference

Before any of the functions can run on mobile, the user needs to interact with the UI.

a. Speak

import StarkSpeech from 'stark-speech';

async function Main () {
  // ... initialize

  await starkSpeech.speak("Hello world!!");
}
Main();

b. Listen With Browser Engine (Online)

import StarkSpeech from 'stark-speech';

async function Main () {
  // ... initialize

  let userMonologues = await starkSpeech.listen();
}
Main();

Obviously this method will not usually work without without a network connection. Further, at least for mobile, the screen needs to be on.

c. Listen for Hotword (Offline)

import StarkSpeech from 'stark-speech';

async function Main () {
  // ... initialize

  await starkSpeech.listenBackground();
  console.log("Hotword detected!");
}
Main();

The first time this method is invoked, the offline detection engine is initialized. That can take one or more seconds.

3. Usage

This library is about the automation of speech in the browser. Communication patterns are now simple to implement, for example this parrot loop:

import StarkSpeech from 'stark-speech';

async function Main () {
  // ... initialize

  while(true) {
    await starkSpeech.speak("What's my name?");
    await starkSpeech.listenBackground();
    await starkSpeech.speak("Got a cracker?");
    await starkSpeech.speak(`You said ${await starkSpeech.listen();}`);
  }
}
Main();

TODO

  • Offline hotword detection on a WebWorker
  • Voiceprint training & validation through transfer learning