sherpa-onnx

repository·master·Indexed 10 days ago

https://github.com/k2-fsa/sherpa-onnx

A high-performance, multi-platform speech processing toolkit leveraging ONNX Runtime. It provides capabilities for speech recognition (ASR), text-to-speech (TTS), voice activity detection (VAD), speaker diarization, speaker identification, audio tagging, and speech enhancement. Supports multiple APIs including C, Dart, and Android (AAR/APK), with specific support for hardware accelerators and various languages.

Tokens
132.6K
Snippets
400
Records
550
Agent score
91%

What's inside sherpa-onnx

  1. Overview of SenseVoice Nano models

    master

    The SenseVoice Nano models in this directory are converted versions of the Fun-ASR-Nano-2512 models from HuggingFace. These models are optimized for high-performance speech recognition in challenging environments and diverse linguistic scenarios.

    Key Capabilities:

    • Far-field & High-noise Recognition: Optimized for far-distance pickup and noisy environments (e.g., conference rooms, vehicles, industrial sites) with up to 93% accuracy.
    • Chinese Dialects & Accents: Supports 7 major dialects (Wu, Cantonese, Min, Hakka, Gan, Xiang, Jin) and covers 26 regional accents (including Henan, Shaanxi, Hubei, Sichuan, Chongqing, Yunnan, Guizhou, Guangdong, Guangxi, etc.).
    • Multi-language Support: Supports 31 languages, with specific optimization for East and Southeast Asian languages. It supports free language switching and mixed-language recognition.
    • Music Background Recognition: Specifically enhanced to recognize lyrics accurately even when music is playing in the background.
  2. Overview of sherpa-onnx supported functions

    master

    sherpa-onnx provides local execution for a wide range of audio and speech processing tasks, including:

    • Speech-to-text (ASR): Both streaming and non-streaming modes.
    • Text-to-speech (TTS)
    • Speaker Analysis: Diarization, identification, and verification.
    • Language & Audio Identification: Spoken language identification and audio tagging.
    • Audio Processing: VAD (Voice Activity Detection), speech enhancement (e.g., GTCRN, DPDFNet), and source separation (e.g., Spleeter, UVR).
    • Keyword Spotting (KWS)
  3. Overview of Tauri Examples for sherpa-onnx

    master

    The tauri-examples directory contains desktop application implementations built using Tauri v2 and sherpa-onnx. These examples demonstrate how to integrate offline Automatic Speech Recognition (ASR) and Voice Activity Detection (VAD) into cross-platform desktop environments.

    Available examples include:

    • non-streaming-speech-recognition-from-file: Transcribes audio or video files using offline ASR with VAD. Features include support for 62 different models, audio playback, SRT subtitle export, and exporting individual segments as WAV files.
    • non-streaming-speech-recognition-from-microphone: Provides live microphone transcription using offline ASR with VAD. Features include support for 62 models, wall-clock timestamps, recording playback, SRT export, and segment WAV export.
  4. Streaming ASR examples with Dart API

    master

    This directory provides several implementation examples for performing streaming Automatic Speech Recognition (ASR) using the Dart API. Each example is tailored to a specific model architecture. To run these examples, use the provided shell scripts which handle the necessary environment setup and execution parameters.

    | File | Description|
    |------|------------|
    |[./bin/nemo-transducer.dart](./bin/nemo-transducer.dart)| Use a NeMo transducer model for speech recognition. See [./run-nemo-transducer.sh](./run-nemo-transducer.sh)|
    |[./bin/paraformer.dart](./bin/paraformer.dart)| Use a Paraformer model for speech recognition. See [./run-paraformer.sh](./run-paraformer.sh)|
    |[./bin/zipformer-ctc-hlg.dart](./bin/zipformer-ctc-hlg.dart)| Use a Zipformer CTC model with HLG graph for speech recognition. See [./run-zipformer-ctc-hlg.sh](./run-zipformer-ctc-hlg.sh)|
    |[./bin/zipformer-ctc.dart](./bin/zipformer-ctc.dart)| Use a Zipformer CTC model for speech recognition. See [./run-zipformer-ctc.sh](./run-zipformer-ctc.sh)|
    |[./bin/zipformer-transducer.dart](./bin/zipformer-transducer.dart)| Use a Zipformer transducer model for speech recognition. See [./run-zipformer-transducer.sh](./run-zipformer-transducer.sh)|
  5. Explore C# API examples for sherpa-onnx

    master

    The dotnet-examples directory provides various C# implementations for using sherpa-onnx features. Key examples include:

    • Speech Enhancement (Offline):
      • speech-enhancement-gtcrn: Uses GTCRN models for offline speech denoising.
      • speech-enhancement-dpdfnet: Uses DPDFNet models for offline speech denoising. For downstream ASR, use 16 kHz models like dpdfnet_baseline.onnx, dpdfnet2.onnx, dpdfnet4.onnx, or dpdfnet8.onnx. For 48 kHz enhancement output, use dpdfnet2_48khz_hr.onnx.
    • Speech Enhancement (Online/Streaming):
      • streaming-speech-enhancement-gtcrn: Uses GTCRN models for online speech denoising.
      • streaming-speech-enhancement-dpdfnet: Uses DPDFNet models for online speech denoising.
    • Text-to-Speech (TTS):
      • zipvoice-tts: Uses ZipVoice for Chinese/English zero-shot text-to-speech.
      • zipvoice-tts-play: Uses ZipVoice for Chinese/English zero-shot text-to-speech with audio playback.

    For full API details, refer to the official C# API documentation.

  6. Supported platforms and architectures for sherpa-onnx

    master

    sherpa-onnx supports multiple architectures across various operating systems:

    ArchitectureAndroidiOSWindowsmacOSLinuxHarmonyOS
    x64✔️✔️✔️✔️✔️
    x86✔️✔️
    arm64✔️✔️✔️✔️✔️✔️
    arm32✔️✔️✔️
    riscv64✔️
  7. HarmonyOS On-Device Feature Examples

    master

    The harmony-os directory contains several implementation examples for running speech and audio tasks on-device:

  8. Supported programming languages for sherpa-onnx

    master

    sherpa-onnx is highly portable and supports a wide array of programming languages and runtimes:

    • C/C++: C, C++
    • Managed/Mobile: Java, Kotlin, C#, Swift, Dart
    • Scripting/Web: Python, JavaScript, WebAssembly
    • Systems: Go, Rust, Pascal
  9. Non-streaming ASR examples with Dart API

    master

    This directory provides several Dart-based examples for performing non-streaming Automatic Speech Recognition (ASR). Each example is tailored to a specific model architecture or model provider. To run these examples, use the corresponding .sh shell script provided for each binary.

    | File | Description |
    |------|------------|
    |[./bin/dolphin-ctc.dart](./bin/dolphin-ctc.dart)| Use a Dolphin Ctc model for speech recognition. See [./run-dolphin-ctc.sh](./run-dolphin-ctc.sh)|
    |[./bin/nemo-ctc.dart](./bin/nemo-ctc.dart)| Use a NeMo Ctc model for speech recognition. See [./run-nemo-ctc.sh](./run-nemo-ctc.sh)|
    |[./bin/nemo-transducer.dart](./bin/nemo-transducer.dart)| Use a NeMo transducer model for speech recognition. See [./run-nemo-transducer.sh](./run-nemo-transducer.sh)|
    |[./bin/paraformer.dart](./bin/paraformer.dart)|Use a paraformer model for speech recognition. See [./run-paraformer.sh](./run-paraformer.sh)|
    |[./bin/telespeech-ctc.dart](./bin/telespeech-ctc.dart)| Use models from Tele-AI/TeleSpeech-ASR for speech recognition. See [./run-telespeech-ctc.sh](./run-telespeech-ctc.sh)|
    |[./bin/whisper.dart](./bin/whisper.dart)| Use whisper for speech recognition. See [./run-whisper.sh](./run-whisper.sh)|
    |[./bin/zipformer-transducer.dart](./bin/zipformer-transducer.dart)| Use a zipformer transducer for speech recognition. See [./run-zipformer-transducer.sh](./run-zipformer-transducer.sh)|
    |[./bin/vad-with-paraformer.dart](./bin/vad-with-paraformer.dart)| Use a silero-vad with paraformer for speech recognition. See [./run-vad-with-paraformer.sh](./run-vad-with-paraformer.sh)|
    |[./bin/sense-voice.dart](./bin/sense-voice.dart)| Use a SenseVoice CTC model for speech recognition. See [./run-sense-voice.sh](./run-sense-voice.sh)|