k2-fsa/sherpa-onnx
C++ and ONNX Runtime SDK for offline speech and real-time transcription
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & 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.
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.
You need a managed, drop-in Whisper API endpoint or cannot own model selection, native packaging, and target-device validation.
Comparison vs. Top Voice, Vision & Video Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| sherpa-onnx ★ | 16.4k | +136 | C++ | Apache-2.0 | C++ and ONNX Runtime SDK for offline speech and real-time transcription |
| whisperX | 26.5k | +677 | Python | BSD-2-Clause | Batched Whisper with forced alignment for word timings and optional speaker labe |
| moonshine | 11.7k | +48 | C++ | — | On-device C++ SDK for live transcription, intent recognition, and speech synthes |
| mlx-audio | 8.4k | +32 | Python | MIT | MLX inference SDK for local speech and audio pipelines on Apple Silicon |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/k2-fsa/sherpa-onnx.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about sherpa-onnx
How should I integrate live transcription?
Do I need a GPU, and how should I size the runtime?
Can I ship it commercially or self-host it for sensitive audio?
Is it a drop-in replacement for a hosted Whisper API?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy