# Repository Briefing: k2-fsa/sherpa-onnx
> Source: https://repoforai.com/repo/k2-fsa/sherpa-onnx (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/k2-fsa/sherpa-onnx
- **Official Docs / Website**: https://k2-fsa.github.io/sherpa/onnx/index.html
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: C++
- **License**: Apache-2.0
- **Engineering Health**: A+ (97/100 · Maintenance 35/35 · Adoption 22/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v2.0.3 (2026-11-22) — https://github.com/k2-fsa/sherpa-onnx/releases
- **Review Snapshot**: 2026-12-01
- **Deployment / Stack Signals**: Self-Hosted, Local AI, API
- **Momentum**: 16,424 ★ total (+20 24h / +136 7d) · 1,968 forks
- **Topics**: `asr`, `onnx`, `windows`, `linux`, `macos`, `cpp`, `android`, `ios`, `raspberry-pi`, `aarch64`, `arm32`, `csharp`
- **When to Use**: Best for: Teams embedding offline voice features in apps or edge devices, or self-hosting live transcription with control over where audio is processed and which models run. Skip if: You need a managed, drop-in Whisper API endpoint or cannot own model selection, native packaging, and target-device validation.

## Overview
```text
### Architecture & Core Mechanics
sherpa-onnx is a native C++ speech and audio SDK with an ONNX Runtime-based inference stack. Applications supply audio to a task-specific API and configure the corresponding model assets. Streaming ASR accepts successive chunks for a live session; non-streaming ASR processes a completed recording or segment. VAD, synthesis, and speaker processing are separate capabilities an application can compose, not stages every request must pass through.

The native integration surface is visible in `CMakeLists.txt`, `cmake/`, `c-api-examples/`, and `cxx-api-examples/`; `Package.swift` and the Swift and SwiftUI example directories provide Apple integration entry points. Twelve language APIs, including Python, C#, Go, Dart, and Rust, provide alternatives to writing a C++ application. The WebSocket server/client path places inference behind a network boundary; use it when service separation matters, not on the assumption that the SDK implements a managed transcription API contract.

### Key Capabilities & Differentiators
The recognition catalog gives teams distinct choices for live and recorded audio: streaming Zipformer includes Chinese–English bilingual variants and compact Chinese and English models listed for Cortex-A7; non-streaming examples include Whisper `tiny.en` and the English NeMo Parakeet TDT 0.6B v2 INT8 package. Forced alignment solves a different problem: given audio and its transcript, it produces word-level timestamps. Available bundles include Chinese pinyin models and English MFA models with pronunciation dictionaries.

The SDK also covers TTS, speaker diarization, identification and verification, spoken-language identification, punctuation, audio tagging, VAD, keyword spotting, enhancement, and source separation. Teams can combine these selectively—for example, segment speech with VAD before non-streaming recognition—but should evaluate each stage separately. Supported acceleration paths include RKNN, QNN, Ascend, Axera, and OpenVINO for Intel NPU; the platform and accelerator lists are not an all-model compatibility matrix.

### Trade-offs & Limitations
Compared with a hosted Whisper API, sherpa-onnx keeps inference under your control and can run without an internet connection once the runtime and models are in place. It also covers tasks beyond transcription. The trade-off is that your team selects and distributes models, handles native compatibility, and owns upgrades and capacity. A hosted API is simpler when the requirement is only to send a recording and receive text, and sending audio to an external service is acceptable.

Local inference removes a cloud round trip, but it is not automatically faster end to end. Compare accuracy on representative audio, time to first partial result for streaming, sustained throughput, and peak memory at the intended concurrency. On edge devices, also check package size and sustained performance under thermal limits. Apache-2.0 covers the SDK; verify the terms of model weights, dictionaries, and any bundled dependencies separately before redistribution.

### Hardware & Deployment Guide
For an offline app, provision the native runtime or target binding and the selected model assets before network access is removed. Use the CMake build path for native source builds. The tree includes Android ABI, iOS, HarmonyOS, ARM Linux, and RISC-V Linux scripts, as well as task-specific WASM SIMD builds. Pre-built Android APKs are useful for evaluating individual tasks; the iOS Flutter TTS demo has a source-build requirement. For self-hosting, the WebSocket server/client path gives networked applications a service boundary without requiring managed inference.

Pin the SDK build and tested model assets together when distributing an app or operating a service. In v2.0.2, changes included a fix for NeMo TDT speech dropped by modified beam search, per-stream language candidates for Whisper, and an optional QNN HTP performance mode. In v2.0.3, diarization clustering was restricted to embeddings with enough clean speech, and a no-op Pad before AveragePool was removed from WeSpeaker CAM++ models. Include representative audio and target hardware in regression tests when adopting those changes.
```

## Key Capabilities
```text
- Recognition modes: Streaming Chinese–English Zipformer for incremental results; non-streaming Whisper and NeMo Parakeet TDT for completed audio.
- Transcript alignment: Forced alignment produces word-level timestamps from audio and an existing transcript, with Chinese pinyin and English MFA model bundles.
- Integration: Native C and C++ examples, APIs across 12 languages, and a WebSocket server/client route alongside in-process embedding.
- Portable builds: CMake plus target-specific scripts for Android, iOS, HarmonyOS, Linux on ARM and RISC-V, and task-specific WebAssembly SIMD builds.
- Accelerator options: Rockchip RKNN, Qualcomm QNN, Ascend, Axera, and Intel NPU via OpenVINO; verify the exact model and build for each target.
- Audio pipeline components: VAD and keyword spotting support voice interfaces; diarization, enhancement, and source separation address distinct recording workflows.
```

## Quick Start / Clone
```bash
git clone --depth 1 https://github.com/k2-fsa/sherpa-onnx.git
cd sherpa-onnx
```
