# sherpa-onnx

> On-device speech-to-text, text-to-speech and more, powered by ONNX Runtime

- Category: Multimodal Generation / Audio, Music & Voice
- Language: C++
- Licence: Apache-2.0
- Repository: https://github.com/k2-fsa/sherpa-onnx
- Website: https://k2-fsa.github.io/sherpa/onnx/index.html
- Canonical page: https://ai-tldr.dev/tools/sherpa-onnx/

## In short

sherpa-onnx is an open-source speech toolkit from the k2-fsa project that runs entirely on your own device, with no cloud service required. It uses ONNX Runtime to execute pre-trained models, so the same speech features work the same way across many machines. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in C++ and licensed Apache-2.0.

## Overview

sherpa-onnx is an open-source speech toolkit from the k2-fsa project that runs entirely on your own device, with no cloud service required. It uses ONNX Runtime to execute pre-trained models, so the same speech features work the same way across many machines.

It covers a wide range of audio tasks in one package: speech-to-text (both streaming and non-streaming), text-to-speech, speaker identification, speaker verification, speaker diarization, spoken language identification, audio tagging, voice activity detection, keyword spotting, punctuation, speech enhancement and source separation.

The toolkit is unusually portable. It runs on Linux, macOS, Windows, Android, iOS and HarmonyOS, on x86, ARM and RISC-V chips, and even in the browser through WebAssembly. You can call it from many languages, including Python, C++, C, Go, C#, Java, Kotlin, JavaScript, Swift, Rust and Dart.

## What it does

- Offline speech-to-text with both streaming (real-time) and non-streaming modes, supporting many languages and model families such as Zipformer, Paraformer, Whisper and SenseVoice.
- Local text-to-speech that turns written text into audio without any network call.
- Speaker tools: identification, verification and diarization to tell who is speaking and separate speakers in a recording.
- Voice activity detection, keyword spotting, punctuation, audio tagging, spoken language identification, speech enhancement and source separation.
- Broad platform reach: desktop, Android, iOS, HarmonyOS, NodeJS, WebAssembly, Raspberry Pi and NVIDIA Jetson, on CPU, GPU and several NPUs.
- Bindings for a dozen programming languages, so you can embed speech features in almost any stack.

## Getting started

The fastest way to try sherpa-onnx is the Python package. It installs a CPU-only build that works on Linux, macOS and Windows. You then download a pre-trained model and run one of the bundled examples.

1. Install the Python package

   Install the CPU-only build from PyPI. This pulls in the core library and its prebuilt binaries.

```bash
pip install sherpa-onnx sherpa-onnx-bin
```

2. Pick a pre-trained model

   sherpa-onnx does not ship models inside the package. Browse the documentation for the task you need (for example speech recognition or text-to-speech) and download a ready-made model, then unpack it locally.

3. Run a built-in example

   The repository includes ready-to-run example scripts for each task under python-api-examples, so you can confirm your install and model work before writing your own code.

4. Try it in the browser first

   If you would rather test without installing anything, the project hosts live demos on Hugging Face Spaces for speech recognition, text-to-speech, speaker diarization and more.

## When to use it

- Add private, offline voice transcription to a desktop or mobile app where audio must never leave the device.
- Generate spoken audio from text locally for voice assistants, accessibility tools or read-aloud features.
- Build meeting tools that detect speech, identify speakers and separate who said what using diarization and speaker ID.
- Run real-time captioning or keyword spotting on low-power hardware such as Raspberry Pi, NVIDIA Jetson or in a web page via WebAssembly.
