Skip to main content

React Native Sherpa-ONNX

Offline on-device speech processing for React Native. Add speech-to-text, text-to-speech, speaker diarization, and VAD to your mobile apps — completely offline, with full privacy.

Quick Start

Get up and running with Sherpa-ONNX in your React Native app in minutes.

1

Install the package

Add react-native-sherpa-onnx to your React Native project using your preferred package manager.
npm install react-native-sherpa-onnx
For iOS, run pod install to complete the setup. See the Installation guide for platform-specific details.
2

Download a model

Download a pre-trained model for your use case. Models are available for speech-to-text, text-to-speech, and more.
import { ModelDownloadManager } from 'react-native-sherpa-onnx/download';

const manager = new ModelDownloadManager();
await manager.downloadModel({
  url: 'https://github.com/k2-fsa/sherpa-onnx/releases/download/...',
  destinationDir: '/path/to/models'
});
Browse available models in the Models section.
3

Initialize and use

Create a speech-to-text or text-to-speech engine and start processing audio.
import { createSTT } from 'react-native-sherpa-onnx/stt';

const stt = await createSTT({
  modelPath: { type: 'file', path: '/path/to/model' }
});

const result = await stt.transcribeFile('/path/to/audio.wav');
console.log(result.text);

await stt.destroy();
See the Quickstart for a complete example.

Core Features

Powerful speech processing capabilities for your React Native apps.

Speech-to-Text

Offline transcription with support for Whisper, Paraformer, Zipformer, and more.

Streaming STT

Real-time speech recognition with partial results and endpoint detection.

Text-to-Speech

High-quality voice synthesis with VITS, Matcha, Kokoro, and other TTS models.

Streaming TTS

Low-latency incremental speech generation for responsive user experiences.

Hardware Acceleration

Leverage NNAPI, XNNPACK, Core ML, and QNN for optimized performance.

Model Management

Flexible model loading from assets, file system, or Play Asset Delivery.

Explore by Topic

Dive deeper into specific features and integrations.

API Reference

Complete API documentation with types and examples.

Model Catalog

Browse supported STT and TTS models with download links.

Advanced Usage

PCM streaming, hotwords, and model detection.

Configuration

Optimize bundle size and configure platform features.

Migration Guide

Upgrade from previous versions with breaking changes.

Examples

Sample apps and real-world integration patterns.

Ready to get started?

Follow our quickstart guide to add offline speech processing to your React Native app in minutes.

Start Building

Build docs developers (and LLMs) love