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

@sinhala-typer/voice-typing

v0.1.0

Published

A generic Web Speech API + Web Audio voice-typing wrapper: diffed text edits (not wholesale replacement) as recognition refines each utterance, plus a volume meter. Not Sinhala-specific - locale is fully configurable.

Readme

@sinhala-typer/voice-typing

A generic Web Speech API + Web Audio voice-typing wrapper. Not Sinhala-specific — despite the package scope, lang is fully caller-configurable and this has zero dependency on @sinhala-typer/typing-engine or any other package in this monorepo. It happens to ship alongside a Sinhala typing tool; it isn't about Sinhala.

What it adds on top of the raw SpeechRecognition API:

  • Diffed edits, not wholesale replacement. The Web Speech API repeatedly re-reports a growing/refining transcript for the same utterance ("hell""hello""hello world"). This computes the minimal { deleteCount, insertText } delta between what you last showed and the new transcript, so you never have to blindly delete-and-retype the whole phrase on every update.
  • A volume meter (AnalyserNode-based, not the deprecated ScriptProcessorNode) for "is it hearing me" visual feedback — a second, independent microphone stream, since SpeechRecognition exposes no way to observe its own internal audio capture.
  • A start-timeout safeguard. In some environments recognition.start() returns normally but the browser never fires any event — not onstart, not onerror. Left alone this hangs a UI in "listening" forever; this package gives up and reports a clean error after 8 seconds if the browser never confirms it actually started.
  • Structured errors, not raw browser error strings.

Install

npm install @sinhala-typer/voice-typing

Usage

import { createVoiceTyping } from "@sinhala-typer/voice-typing";

const voice = createVoiceTyping({
  lang: "en-US", // defaults to "si-LK" if omitted
  onEdit: (edit) => {
    // apply edit.deleteCount / edit.insertText to your own text buffer,
    // e.g. via @sinhala-typer/typing-engine-dom's TypingController.applyExternalEdit()
  },
  onStateChange: (state) => console.log(state), // "idle" | "listening"
  onVolumeChange: (level) => console.log(level), // 0-1
  onError: (error) => console.error(error.code, error.message),
});

if (voice.isSupported) {
  voice.start();
  // later:
  voice.stop();
}

Browser support

Requires SpeechRecognition/webkitSpeechRecognition. Chrome, Edge, and Safari support it; Firefox has never shipped it — this is a real, permanent platform gap, not something this package works around. Check isSupported and hide/disable your UI accordingly rather than assuming it's always available.

API

  • createVoiceTyping(options)VoiceTypingController
    • isSupported: boolean
    • start() / stop()
  • VoiceTypingOptions:
    • lang?: string — BCP-47 locale, defaults to "si-LK".
    • onEdit(edit: Edit) — required. Edit = { deleteCount: number; insertText: string }.
    • onStateChange?(state: "idle" | "listening")
    • onVolumeChange?(level: number) — 0-1, best-effort (silently omitted if the browser denies the metering microphone stream).
    • onError?(error: VoiceTypingError)VoiceTypingError.code is one of "not-allowed" | "no-speech" | "audio-capture" | "unsupported" | "unknown".

License

MIT