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

@questionwell/browser-tts

v0.1.3

Published

Minimal browser-only SpeechSynthesis helper with ergonomic speaker hints.

Readme

Minimal helper around the Web Speech API’s speechSynthesis voices. Provide hints like "French Woman" or "pt-BR Man" and let the helper pick the best available voice on the device with graceful fallbacks. Learn more about Questionwell at questionwell.org.

📢 Browser-only: this package no-ops during SSR and must be triggered from a user gesture in some browsers.

Installation

npm install @questionwell/browser-tts

Usage

import { TTS } from "@questionwell/browser-tts";

await TTS.speak("Bonjour tout le monde", "French Woman");

// Optional helpers
TTS.stop();
const isSpeaking = TTS.isSpeaking();
const voices = await TTS.getVoices();

// Extend metadata for edge-case voices
TTS.registerVoiceMetadata([
  { name: "Custom Voice", lang: "en-US", gender: "female", priority: 10 },
]);

API

TTS.speak(message, speakerHint, options?)

Speaks message using the best matching SpeechSynthesisVoice for speakerHint. Returns a Promise<void> that resolves when all utterances finish.

  • message – Full text to speak (long strings are split into bite-size utterances).
  • speakerHint – Natural language description such as "English Woman" or "pt-BR Man". Language keywords, gender hints, and a few regional aliases are supported out of the box.
  • options – Optional SpeakOptions.

The method silently no-ops during SSR or when window.speechSynthesis is unavailable, so it is safe to call from shared code.

SpeakOptions

| Option | Type | Default | Description | | ------------ | ----------- | ------- | ----------- | | rate | number | 1.0 | Playback rate (0.110). | | pitch | number | 1.0 | Pitch adjustment (02). | | volume | number | 1.0 | Volume (01). | | onBoundary | (event) => void | – | Fired for each boundary event (word/char) emitted by the underlying utterance. | | onEnd | () => void | – | Called after the final utterance finishes. | | onError | (err) => void | – | Receives SpeechSynthesisErrorEvent or Error instances. |

TTS.stop()

Cancels any speech in progress and clears internal state. Safe to call even when nothing is speaking.

TTS.isSpeaking()

Returns true while the browser speech synthesizer is mid-utterance. Always returns false on the server.

TTS.getVoices()

Resolves with the cached SpeechSynthesisVoice[] after ensuring voices are loaded. Useful for building custom pickers or debugging voice availability.

TTS.registerVoiceMetadata(extraMetadata)

Accepts an array of metadata objects:

type VoiceMetadata = {
  name: string;
  lang?: string;
  gender?: "female" | "male" | "neutral";
  aliases?: string[];
  priority?: number;
};

Metadata entries extend the internal voice lookup table at runtime, making it easy to alias vendor-specific names or bump priorities for voices your product prefers. See inline docs in src/tts.ts for additional guidance.

License

Released under the GNU Affero General Public License v3.0. You must comply with the AGPL when distributing or hosting derivative works.