transcribe-rs
Multi-engine speech-to-text library for Rust. Supports Parakeet, Moonshine, SenseVoice, GigaAM, Whisper, Whisperfile, and OpenAI.
Breaking Changes in 0.3.0
Version 0.3.0 changes the SpeechModel trait. If you need the old API, pin to version = "=0.2.9".
transcribe()andtranscribe_file()now take&TranscribeOptionsinstead ofOption<&str>for languageSpeechModelrequiresSend, enablingBox<dyn SpeechModel + Send>across threadsTranscribeOptionsincludes atranslatefield for Whisper/Whisperfile translation supportWhisperEngine::capabilities()now returns actual model language support (English-only vs multilingual) instead of always reporting 99 languages
Note: 0.3.0 is a large migration. We believe correctness is preserved for all engines, but expect potential issues as this stabilizes. Please report any problems on GitHub.
Installation
[]
= { = "0.3", = ["onnx"] }
No features are enabled by default. Pick the engines you need:
| Feature | Engines |
|---|---|
onnx |
Parakeet, Moonshine, SenseVoice, GigaAM (via ONNX Runtime) |
whisper-cpp |
Whisper (local, GGML via whisper.cpp with Metal/Vulkan) |
whisperfile |
Whisperfile (local server wrapper) |
openai |
OpenAI API (remote, async) |
all |
Everything above |
Quick Start
use ;
use Quantization;
use PathBuf;
let mut model = load?;
let samples = read_wav_samples?;
let result = model.transcribe_with?;
println!;
All local engines implement the SpeechModel trait. Remote engines (OpenAI) implement RemoteTranscriptionEngine separately because they are async and file-based.
Usage by Engine
SenseVoice
use ;
use Quantization;
use PathBuf;
let mut model = load?;
let samples = read_wav_samples?;
let result = model.transcribe_with?;
Moonshine
use ;
use Quantization;
use SpeechModel;
use PathBuf;
let mut model = load?;
let result = model.transcribe_file?;
Streaming variant:
use StreamingModel;
use Quantization;
use SpeechModel;
use PathBuf;
let mut model = load?;
let result = model.transcribe_file?;
GigaAM
use GigaAMModel;
use Quantization;
use SpeechModel;
use PathBuf;
let mut model = load?;
let result = model.transcribe_file?;
Whisper (whisper.cpp)
use ;
use PathBuf;
let mut engine = load?;
let samples = read_wav_samples?;
let result = engine.transcribe_with?;
Whisperfile
use ;
use PathBuf;
let mut engine = load_with_params?;
let samples = read_wav_samples?;
let result = engine.transcribe_with?;
// Server shuts down automatically when engine is dropped.
OpenAI (Remote)
use ;
use ;
use PathBuf;
async
Models
All audio input must be 16 kHz, mono, 16-bit PCM WAV.
Model Downloads
| Engine | Download |
|---|---|
| Parakeet (int8) | blob.handy.computer / HuggingFace |
| SenseVoice (int8) | blob.handy.computer / sherpa-onnx |
| Moonshine | HuggingFace |
| GigaAM | HuggingFace |
| Whisper (GGML) | HuggingFace |
| Whisperfile binary | GitHub |
Directory Layouts
Parakeet (directory):
models/parakeet-tdt-0.6b-v3-int8/
├── encoder-model.int8.onnx
├── decoder_joint-model.int8.onnx
├── nemo128.onnx
└── vocab.txt
SenseVoice (directory):
models/sense-voice/
├── model.int8.onnx
└── tokens.txt
Moonshine (directory):
models/moonshine-base/
├── encoder_model.onnx
├── decoder_model_merged.onnx
└── tokenizer.json
Moonshine Streaming (directory):
models/moonshine-streaming/moonshine-tiny-streaming-en/
├── encoder.onnx
├── decoder.onnx
├── streaming_config.json
└── tokenizer.json
GigaAM (directory):
models/giga-am-v3/
├── model.onnx (or model.int8.onnx)
└── vocab.txt
Whisper: single file (e.g. whisper-medium-q4_1.bin).
Moonshine Variants
| Variant | Language |
|---|---|
| Tiny | English |
| TinyAr | Arabic |
| TinyZh | Chinese |
| TinyJa | Japanese |
| TinyKo | Korean |
| TinyUk | Ukrainian |
| TinyVi | Vietnamese |
| Base | English |
| BaseEs | Spanish |
Examples and Tests
Each engine has an example in examples/. Run with the appropriate feature flag:
Tests are also feature-gated. Models must be present locally; tests skip gracefully if not found.
Whisperfile tests look for the binary at models/whisperfile-0.9.3 (override with WHISPERFILE_BIN) and model at models/ggml-small.bin (override with WHISPERFILE_MODEL). GigaAM tests require samples/russian.wav.
Development aliases from .cargo/config.toml:
Performance
Parakeet int8 benchmarks:
| Platform | Speed |
|---|---|
| MBP M4 Max | ~30x real-time |
| Zen 3 (5700X) | ~20x real-time |
| Skylake (i5-6500) | ~5x real-time |
| Jetson Nano CPU | ~5x real-time |
Acknowledgments
- istupakov for the ONNX Parakeet and GigaAM exports
- NVIDIA for Parakeet
- whisper.cpp
- jart / Mozilla AI for llamafile and Whisperfile
- UsefulSensors for Moonshine
- FunASR / sherpa-onnx for SenseVoice
- SberDevices for GigaAM