Files
sherpa-onnx/rust-api-examples/run-wenet-ctc-simulate-streaming-microphone.sh
Fangjun Kuang b1f948315e Add Rust example for real-time ASR + VAD (#3397)
This pull request expands the Rust API examples by introducing a comprehensive set of simulated real-time ASR applications integrated with VAD. These additions allow users to interact with various ASR models directly through their microphone, providing a practical demonstration of the sherpa-onnx library's capabilities in a live audio processing context. The changes also include necessary infrastructure for audio resampling and improved output display.
2026-03-24 15:30:03 +08:00

23 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -ex
# https://k2-fsa.github.io/sherpa/onnx/vad/silero-vad.html
if [ ! -f "./silero_vad.onnx" ]; then
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx
fi
# see
# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/wenet-ctc-models.html#sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10-cantonese
if [ ! -f ./sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10/model.int8.onnx ]; then
curl -SsL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10.tar.bz2
tar xvf sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10.tar.bz2
rm sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10.tar.bz2
ls -lh sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10
fi
cargo run --example wenet_ctc_simulate_streaming_microphone --features mic -- \
--silero-vad-model ./silero_vad.onnx \
--model ./sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10/model.int8.onnx \
--tokens ./sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10/tokens.txt