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

@zhenryx/react-native-sherpa-tts

v1.0.4

Published

React Native wrapper for sherpa-onnx offline TTS — Supertonic 3 text-to-speech engine for Android (31 languages)

Readme

react-native-sherpa-tts

React Native wrapper for sherpa-onnx offline TTS — powered by Supertonic 3 (31 languages, on-device, no network).

⚠️ Android only — iOS support is not included in this version.

Setup

1. Install

npm install react-native-sherpa-tts

2. Copy model files to Android assets

Copy the Supertonic 3 model files into your RN project:

# From the model directory on your machine:
cp -r sherpa-onnx-supertonic-3-tts-int8-2026-05-11 \
  android/app/src/main/assets/

The android/app/src/main/assets/ directory should contain:

sherpa-onnx-supertonic-3-tts-int8-2026-05-11/
├── duration_predictor.int8.onnx   (~3.5 MB)
├── text_encoder.int8.onnx         (~35 MB)
├── vector_estimator.int8.onnx     (~75 MB)
├── vocoder.int8.onnx              (~25 MB)
├── tts.json                       (~8 KB)
├── unicode_indexer.bin            (~256 KB)
└── voice.bin                      (~505 KB)

If the assets directory doesn't exist, create it:

mkdir -p android/app/src/main/assets

3. Rebuild

cd android && ./gradlew clean && cd ..
npx react-native run-android

Usage

import SherpaTts from 'react-native-sherpa-tts';

// 1. Init (once, takes 1–3 seconds to load models)
await SherpaTts.init({ lang: 'zh' });

// 2a. Streaming playback — audio starts almost immediately
await SherpaTts.speak('你好世界!今天天气真不错。', { speed: 1.0 });

// 2b. Or generate to file — returns path when done
const { filePath, duration } = await SherpaTts.synthesize('Hello world');

// 3. Stop playback mid-stream
await SherpaTts.stop();

// 4. Release resources (optional — call before app exit)
await SherpaTts.release();

Events

// Listen for speak completion
const sub = SherpaTts.addListener('onSpeakEnd', ({ filePath, duration }) => {
  console.log(`Playback finished: ${duration}s → ${filePath}`);
});

// Listen for errors
SherpaTts.addListener('onSherpaTtsError', ({ context, message }) => {
  console.error(`[${context}] ${message}`);
});

// Unsubscribe
sub.remove();

API

| Method | Returns | Description | |--------|---------|-------------| | init(options?) | Promise<void> | Load models from assets (~1-3s) | | synthesize(text, options?) | Promise<AudioResult> | Generate WAV, returns file path | | speak(text, options?) | Promise<AudioResult> | Stream + play in real-time | | stop() | Promise<void> | Stop current speak() | | release() | Promise<void> | Free memory | | getState() | Promise<string> | Current engine state | | addListener(event, fn) | { remove() } | Subscribe to events |

Options

interface TtsInitOptions {
  modelDir?: string;  // default: 'sherpa-onnx-supertonic-3-tts-int8-2026-05-11'
  lang?: TtsLanguage; // default: 'en' — 31 languages supported
}

interface TtsSynthesizeOptions {
  speed?: number;     // default: 1.0
  lang?: TtsLanguage; // default: uses init lang
}

Supported Languages

en ko ja ar bg cs da de el es et fi fr hi hr hu id it lt lv nl pl pt ro ru sk sl sv tr uk vi

Architecture

JS (src/index.ts)
  ↓ React Native Bridge
Kotlin (SherpaTtsModule.kt)
  ↓ JNI call
C++ (libsherpa-onnx-jni.so)
  ↓ ONNX Runtime
Supertonic 3 ONNX models → PCM audio → AudioTrack / WAV file

License

MIT