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

@polytts/browser

v0.1.2

Published

Browser entrypoint for polytts text-to-speech runtimes.

Readme

@polytts/browser

npm version

Explicit browser entrypoint for polytts.

Use this package when you want the structured scoped package layout for browser apps, PWAs, or Electron renderers.

Install

npm install @polytts/browser

Usage

import { createBrowserTTS } from "@polytts/browser";

const tts = createBrowserTTS({
  initialModelId: "browser-speech",
});

await tts.ready();
await tts.speak("Hello from the browser runtime.");

For progressive audio:

for await (const chunk of tts.synthesizeStream("Hello from a streaming browser model.")) {
  console.log(chunk.sampleRate, chunk.channels[0]?.length ?? 0);
}

The high-level controller also exposes getInstallState(modelId) and isInstalled(modelId) for quick download checks without reading raw runtime state.

If you do not want IndexedDB, pass a custom assetStore:

import { MemoryAssetStore } from "@polytts/core";
import { createBrowserTTS } from "@polytts/browser";

const tts = createBrowserTTS({
  assetStore: new MemoryAssetStore(),
});

@polytts/browser also exports LocalStorageAssetStore, but it is only suitable for tiny assets, demos, and tests. localStorage is usually capped around 5 MB and base64 storage adds roughly 33% overhead, so do not use it for real ONNX bundles.

Lifecycle

The browser controller keeps three separate concepts:

  • selected model and voice
  • downloaded assets
  • loaded runtime instance

Important behavior:

  • initialModelId and initialVoiceId only set the starting selection
  • download(modelId) caches assets, but does not prepare the runtime instance
  • ready(), selectModel(), selectFamily(), and selectVoice() prepare the selected model
  • speak(), synthesize(), and synthesizeStream() prepare on demand if needed

If your UI needs explicit install vs load states, use getInstallState(), isInstalled(), status, phase, and phaseProgress together instead of assuming they mean the same thing.

Voices

Catalog voice metadata and runtime-resolved voices are not always identical.

  • Models such as Piper usually expose stable voices from catalog metadata.
  • Models such as Kokoro may populate their final voice list only after the model is prepared.

If your UI renders a voice picker, expect some models to show no resolved voices until after ready() or selectModel() completes.

Platform notes

  • browser-speech has no download step and depends entirely on the host browser engine.
  • ONNX-backed models may download large bundles and should usually expose progress UI.
  • Piper uses a safer main-thread ONNX path on iOS. That path is broadly compatible, but stop/cancel can only be observed before or after the current inference call returns.
  • Worker-backed models stop more aggressively because the worker can be recycled on abort.

SSR

@polytts/browser is a browser entrypoint. The React providers can render on the server, but createBrowserTTS() and createBrowserTTSRuntime() should still be created in browser/client code.

Exports

  • createBrowserTTS()
  • createBrowserTTSRuntime()
  • browser audio and storage helpers
  • official browser adapters
  • official catalogs from @polytts/presets