Expand description
Safe Rust wrapper for CrispASR speech recognition.
§Quick start
use crispasr::Session;
let sess = Session::open("model.gguf").unwrap();
let pcm = vec![0.0f32; 16000]; // 1s of silence
let segments = sess.transcribe(&pcm).unwrap();
for seg in &segments {
println!("[{:.1}s - {:.1}s] {}", seg.start, seg.end, seg.text);
}Structs§
- Aligned
Word - Chat
Generate Options - Per-call sampler options for the
*_with_optionsgenerate entry points. - Chat
Message - One turn in a conversation.
- Chat
Options - Per-session open options for
ChatSession::open_with_options. - Chat
Session - A chat / LLM session over a GGUF model.
- CrispASR
Deprecated - A loaded CrispASR model (whisper-only, legacy API).
- CtcLogits
- Per-frame CTC logits captured from a CTC backend.
- Diarize
Options - Construct via
Defaultand set fields as needed — the struct grows alongside the append-only C ABI (#332). - Diarize
Segment - One ASR segment passed to
diarize_segments. Caller fillst0/t1(seconds) from the upstream transcribe result; the diarizer writes the zero-based speaker index intospeaker(-1means the method had no info to pick). - Diarize
Turn - A speaker turn the diarizer derived from the AUDIO, independent of the caller’s segment grid (#395).
- Kokoro
Resolved - Result of
kokoro_resolve_for_lang. Mirrors the Python wrapper’sKokoroResolveddataclass. - LidResult
- Mic
- Library-level microphone handle. The user-supplied callback is
invoked from miniaudio’s audio thread with mono float32 PCM in
[-1, 1]. Keep the callback short and non-blocking — for ASR, queue
the audio and feed
Stream::feedfrom another thread. - Parakeet
- Direct Parakeet ASR context with word- and token-level timestamps.
- Parakeet
Result - Parakeet transcription result with word and token accessors.
- Punc
Model - BERT-based punctuation restoration model (FireRedPunc).
- Pyannote
Cache - Pre-computed pyannote-seg posteriors over a full audio buffer.
- Registry
Artifact - One file in a backend’s canonical default download bundle.
- Registry
Bundle - The exact artifact bundle downloaded by
-m auto. - Registry
Entry - Known-model registry entry.
- Segment
- A transcription segment with timing information.
- Session
- Session
Segment - A segment of a unified-session transcription.
- Session
Word - Word-level timing (populated by backends that produce it).
- SpeakerDB
- Speaker database wrapper.
- Speaker
Embedder - Pluggable speaker-embedding model. Wraps the
crispasr_speaker_embedder_*_abifamily in a safe Rust struct. - Stem
- A loaded session over a CrispASR model of any backend.
One stem from
Session::separate: its name (vocals,drums, …) and its interleaved-stereo PCM atSession::separate_sample_rate. - Stream
- Streaming-decoder handle returned by
Session::stream_open. Feed PCM withStream::feed, pull text withStream::get_text, finalize withStream::flush. Auto-closes on drop. - Streaming
Update - One commit from a streaming session — the latest concatenated text plus its absolute audio-time bounds.
- Text
LidResult - Result of
text_detect_language. Label format depends on the loaded GGUF: CLD3 returns ISO 639-1 ("en","de","zh-Latn") across 109 labels; GlotLID-V3 / LID-176 fastText return ISO 639-3 with a script tag ("eng_Latn","sco_Latn") across 2102 or 176 labels respectively. Callers needing ISO 639-1 normalisation must do it on their side — the dispatcher preserves the model’s native space because the script tag carries real information (e.g.zh-Latn≠zh-Hans). - Transcribe
Options - Options for
transcribe_pcm_with_options. Leave defaults for standard Whisper behaviour; setvad: true+vad_model_pathfor built-in Silero VAD, ortdrz: truewith a.en.tdrzmodel for speaker-turn markers. - VadOptions
- Tunables for
Session::transcribe_vad. Defaults mirror crispasr’swhisper_vad_default_paramsplus the max-chunk fallback the shared library uses to bound encoder cost on long audio.
Enums§
- Chat
Error - Why a chat call failed.
- Diarize
Method - Mirrors the append-only
CrispasrDiarizeMethodC enum, so new methods may appear in minor releases — match with a_arm (#332). - LidMethod
- Mirrors the append-only C LID-method enum, so new methods may appear
in minor releases — match with a
_arm (#332). - Registry
Artifact Kind - Role of one artifact in a canonical model download bundle.
Functions§
- agglomerative_
cluster - Agglomerative single-linkage cosine clustering on L2-normalized speaker embeddings.
- align_
words - Run CTC / forced-aligner word timings for a transcript + audio pair.
- cache_
dir - Return the CrispASR cache directory (creating it if missing).
- cache_
ensure_ file - Download
filenamefromurlinto the CrispASR cache — or return the cached path if already present. PassNoneforcache_dir_overrideto use the platform default. - detect_
language_ pcm - Run language identification on a 16 kHz mono float PCM buffer.
- diarize_
segments - Assign a speaker index to each of
segs, mutating eachDiarizeSegment::speakerin place. - diarize_
segments_ with_ turns - Same as
diarize_segments, and additionally returns the speaker turns the method derived from the audio (#395). - enhance_
audio_ rnnoise - RNNoise audio enhancement on 48 kHz mono PCM.
- kokoro_
lang_ has_ native_ voice - Whether
langhas a native Kokoro voice. - kokoro_
lang_ is_ german - Whether
langis German (Kokoro phoneme selection). - kokoro_
resolve_ for_ lang - Resolve the kokoro model + fallback voice for
lang. Mirrors what the CLI does for--backend kokoro -l <lang>(PLAN #56 opt 2b). - lcs_
dedup_ prefix_ count - Chunk-boundary LCS dedup: returns the number of leading tokens
of
curr_tokensto drop to remove overlap withprev_tail_tokens. - list_
known_ models - Look up the canonical GGUF for a backend (whisper, parakeet, canary,
voxtral, voxtral4b, granite, granite-4.1, qwen3, cohere, wav2vec2). Returns
Noneon miss. List every backend name in the registry, in declaration order. - mic_
default_ device_ name - Human-readable name of the default capture device, or empty string if no input device is available.
- registry_
default_ bundle - Return the backend’s exact canonical
-m autoartifact bundle. - registry_
lookup - registry_
lookup_ by_ filename - Look up by filename (exact match, then fuzzy substring).
- text_
detect_ language - Detect the language of a UTF-8 text string via the internal
text_lid_dispatch(peek the GGUF’sgeneral.architecture→ route to CLD3 or fastText). - titanet_
cosine_ sim - TitaNet cosine similarity between two embeddings.
- vad_
segments - Run standalone VAD returning speech spans in centiseconds.
- vad_
slices - Run unified VAD dispatcher returning speech spans in seconds.