Expand description
Raw FFI bindings to CrispASR. Mirrors the public C API in include/whisper.h.
Structs§
- Crispasr
Align Result - Opaque result handle for
crispasr_align_words_abi. Must be freed withcrispasr_align_result_free. - Crispasr
Chat Error - Out-parameter for every chat entry point that can fail (may be null).
Left untouched on success; on failure
codeis non-zero andmessageholds a NUL-terminated diagnostic. - Crispasr
Chat Generate Params - Per-call, sampler-level generate params. Fill via
crispasr_chat_generate_params_defaultbefore overriding fields. - Crispasr
Chat Message - One turn of a conversation.
roleis “system”, “user”, “assistant” or “tool”; both pointers must stay valid for the duration of the call. - Crispasr
Chat Open Params - Per-session, model-level open params. Fill via
crispasr_chat_open_params_defaultbefore overriding fields — the C side reads every one of them. - Crispasr
Chat Session - Opaque handle returned by
crispasr_chat_open. Free withcrispasr_chat_close. - Crispasr
Diarize Opts Abi - ABI options for
crispasr_diarize_segments_abi.methodis a value in 0..4: 0 = Energy, 1 = Xcorr, 2 = VadTurns, 3 = Pyannote, 4 = FoxNose.pyannote_model_pathis required for Pyannote,foxnose_embedder_pathfor FoxNose; each is ignored otherwise. - Crispasr
Diarize SegAbi - ABI segment for
crispasr_diarize_segments_abi. Caller fillst0_cs/t1_cs; the diarizer writesspeaker(-1 if unassigned). - Crispasr
Mic - Opaque microphone handle returned by
crispasr_mic_open. Must be freed withcrispasr_mic_close. (PLAN #62d) - Crispasr
Session - Opaque handle returned by
crispasr_session_open. - Crispasr
Session Result - Opaque result handle returned by
crispasr_session_transcribe. Must be freed withcrispasr_session_result_free. - Crispasr
Stream - Opaque streaming-decoder handle returned by
crispasr_session_stream_open. Must be freed withcrispasr_stream_close. (PLAN #62) - Crispasr
VadAbi Opts - Tunables for
crispasr_session_transcribe_vad. Mirrors crispasr’swhisper_vad_paramsplus the max-chunk fallback used to bound encoder cost on long audio. Pass a null pointer to use defaults. - Whisper
Context - Opaque context handle.
- Whisper
Context Params - Opaque context params handle.
- Whisper
Full Params - Opaque params handle (allocated by whisper_full_default_params_by_ref).
- Whisper
State - Opaque state handle.
Constants§
- CRISPASR_
CHAT_ ERR_ ABORTED - The one error code on the chat ABI with a stable, documented meaning:
a registered abort callback stopped the run. Every other non-zero
CrispasrChatError::codeis a diagnostic aid — readmessage. - CRISPASR_
SAMPLING_ BEAM_ SEARCH - CRISPASR_
SAMPLING_ GREEDY - Sampling strategy.
Functions§
- crispasr_
align_ ⚠result_ free - crispasr_
align_ ⚠result_ n_ words - crispasr_
align_ ⚠result_ word_ t0 - crispasr_
align_ ⚠result_ word_ t1 - crispasr_
align_ ⚠result_ word_ text - crispasr_
align_ ⚠words_ abi - Shared CTC / forced-aligner word timings (0.4.7+).
Pass any
aligner_modelpath — filenames containing “forced-aligner” / “qwen3-fa” / “qwen3-forced” go through the Qwen3-ForcedAligner path; everything else uses canary-ctc. Returns a handle the caller must free withcrispasr_align_result_free. Returns null on failure. - crispasr_
c_ ⚠api_ version - crispasr_
cache_ ⚠dir_ abi - Return the CrispASR cache directory (creating it if missing).
- crispasr_
cache_ ⚠ensure_ file_ abi - Shared HF download + cache (0.4.8+). Writes the resolved path
into
out_buf. Returns 0 on success, -1 on invalid args, 1 on download failure, 2 when the output buffer is too small. - crispasr_
chat_ ⚠ai_ disclosure_ text - Canonical EU AI Act Art. 50(1) “you are talking to an AI” wording. Static string — never null, never freed.
- crispasr_
chat_ ⚠close - crispasr_
chat_ ⚠count_ tokens - Prompt tokens a FRESH session prefills for
messages— chat template, BOS, and the trailing generation prompt included. Negative on failure, witherrfilled. - crispasr_
chat_ ⚠generate - Returns a malloc’d UTF-8 string (free with
crispasr_chat_string_free) or null on failure / abort. - crispasr_
chat_ ⚠generate_ params_ default - crispasr_
chat_ ⚠generate_ stream - 0 on clean completion (including stop-sequence / EOG termination),
CRISPASR_CHAT_ERR_ABORTEDwhen the abort callback stopped it, other non-zero on failure. - crispasr_
chat_ ⚠memory_ estimate - Approximate working set in bytes for a GGUF chat model on disk, or
0 when it could not be estimated (
errfilled). - crispasr_
chat_ ⚠n_ ctx - crispasr_
chat_ ⚠open - crispasr_
chat_ ⚠open_ params_ default - crispasr_
chat_ ⚠reset - crispasr_
chat_ ⚠set_ abort_ callback - Register
cbon the session (null clears it). Takes the session lock, so calling it during a generation blocks rather than cancelling — register before starting one. - crispasr_
chat_ ⚠string_ free - crispasr_
chat_ ⚠template_ name - crispasr_
detect_ ⚠backend_ from_ gguf - crispasr_
detect_ ⚠language - crispasr_
detect_ ⚠language_ pcm - Shared language identification (0.4.6+).
methodis 0 for whisper, 1 for silero.model_pathis required. Fillsout_lang_bufwith a null-terminated ISO 639-1 code. Returns 0 on success, -1 on invalid args, 1 on model / detect failure, 2 when the output buffer is too small. - crispasr_
diarize_ ⚠segments_ abi - Shared speaker diarization (0.4.5+). Writes a zero-based speaker
index into each
segs[i].speaker. Returns 0 on success, 1 on Pyannote model load failure, -1 on invalid args. - crispasr_
enhance_ ⚠audio_ rnnoise - crispasr_
kokoro_ ⚠lang_ has_ native_ voice_ abi - crispasr_
kokoro_ ⚠lang_ is_ german_ abi - crispasr_
kokoro_ ⚠resolve_ fallback_ voice_ abi - crispasr_
kokoro_ ⚠resolve_ model_ for_ lang_ abi - crispasr_
lcs_ ⚠dedup_ prefix_ count - crispasr_
mic_ ⚠close - crispasr_
mic_ ⚠default_ device_ name - crispasr_
mic_ ⚠open - crispasr_
mic_ ⚠start - crispasr_
mic_ ⚠stop - crispasr_
parakeet_ ⚠free - crispasr_
parakeet_ ⚠init - crispasr_
parakeet_ ⚠result_ free - crispasr_
parakeet_ ⚠result_ n_ tokens - crispasr_
parakeet_ ⚠result_ n_ words - crispasr_
parakeet_ ⚠result_ text - crispasr_
parakeet_ ⚠result_ token_ p - crispasr_
parakeet_ ⚠result_ token_ t0 - crispasr_
parakeet_ ⚠result_ token_ t1 - crispasr_
parakeet_ ⚠result_ token_ text - crispasr_
parakeet_ ⚠result_ word_ t0 - crispasr_
parakeet_ ⚠result_ word_ t1 - crispasr_
parakeet_ ⚠result_ word_ text - crispasr_
parakeet_ ⚠transcribe - crispasr_
params_ ⚠set_ alt_ n - crispasr_
params_ ⚠set_ best_ of - crispasr_
params_ ⚠set_ detect_ language - crispasr_
params_ ⚠set_ initial_ prompt - crispasr_
params_ ⚠set_ language - crispasr_
params_ ⚠set_ max_ len - crispasr_
params_ ⚠set_ max_ tokens - crispasr_
params_ ⚠set_ n_ threads - crispasr_
params_ ⚠set_ no_ context - crispasr_
params_ ⚠set_ print_ progress - crispasr_
params_ ⚠set_ print_ realtime - crispasr_
params_ ⚠set_ print_ special - crispasr_
params_ ⚠set_ print_ timestamps - crispasr_
params_ ⚠set_ single_ segment - crispasr_
params_ ⚠set_ split_ on_ word - crispasr_
params_ ⚠set_ suppress_ blank - crispasr_
params_ ⚠set_ tdrz - crispasr_
params_ ⚠set_ temperature - crispasr_
params_ ⚠set_ token_ timestamps - crispasr_
params_ ⚠set_ translate - crispasr_
params_ ⚠set_ vad - crispasr_
params_ ⚠set_ vad_ min_ silence_ ms - crispasr_
params_ ⚠set_ vad_ min_ speech_ ms - crispasr_
params_ ⚠set_ vad_ model_ path - crispasr_
params_ ⚠set_ vad_ threshold - crispasr_
pcm_ ⚠free - crispasr_
punc_ ⚠free - crispasr_
punc_ ⚠free_ text - crispasr_
punc_ ⚠init - crispasr_
punc_ ⚠process - crispasr_
pyannote_ ⚠cache_ apply_ abi - Score
segsagainst the cached posteriors.slice_t0_csis the absolute centisecond at which the cache buffer starts (typically 0 — the cache covers the whole input audio). - crispasr_
pyannote_ ⚠cache_ compute_ abi - Pre-compute pyannote-seg posteriors over a full audio buffer.
Returns an opaque cache or null on failure. Free with
crispasr_pyannote_cache_free_abi. - crispasr_
pyannote_ ⚠cache_ free_ abi - crispasr_
registry_ ⚠default_ bundle_ artifact_ abi - Read one default-bundle artifact by index. 0 = success.
- crispasr_
registry_ ⚠default_ bundle_ info_ abi - Describe the exact canonical artifact bundle downloaded by
-m auto. Returns its artifact count, 0 on miss, or a negative argument/buffer error. - crispasr_
registry_ ⚠list_ backends_ abi - Shared known-model registry lookup by filename (exact then fuzzy).
- crispasr_
registry_ ⚠lookup_ abi - Shared known-model registry lookup by backend. 0 = hit, 1 = miss.
- crispasr_
registry_ ⚠lookup_ by_ filename_ abi - crispasr_
session_ ⚠accept_ marking_ responsibility - crispasr_
session_ ⚠available_ backends - Write a comma-separated list of backend names the loaded dylib was built with. Returns the number of bytes written (not counting NUL) or a negative error.
- crispasr_
session_ ⚠backend - crispasr_
session_ ⚠close - crispasr_
session_ ⚠detect_ language - crispasr_
session_ ⚠detected_ language - crispasr_
session_ ⚠get_ speaker_ name - crispasr_
session_ ⚠input_ channels - crispasr_
session_ ⚠input_ sample_ rate - crispasr_
session_ ⚠is_ custom_ voice - crispasr_
session_ ⚠is_ voice_ design - crispasr_
session_ ⚠kokoro_ clear_ phoneme_ cache - crispasr_
session_ ⚠n_ speakers - crispasr_
session_ ⚠n_ vocab - crispasr_
session_ ⚠open - crispasr_
session_ ⚠open_ explicit - crispasr_
session_ ⚠open_ with_ params - crispasr_
session_ ⚠output_ channels - crispasr_
session_ ⚠output_ sample_ rate - crispasr_
session_ ⚠result_ free - crispasr_
session_ ⚠result_ logits - crispasr_
session_ ⚠result_ n_ logit_ frames - crispasr_
session_ ⚠result_ n_ logit_ vocab - crispasr_
session_ ⚠result_ n_ segments - crispasr_
session_ ⚠result_ n_ words - crispasr_
session_ ⚠result_ segment_ no_ speech_ prob - crispasr_
session_ ⚠result_ segment_ t0 - crispasr_
session_ ⚠result_ segment_ t1 - crispasr_
session_ ⚠result_ segment_ text - crispasr_
session_ ⚠result_ word_ alt_ p - crispasr_
session_ ⚠result_ word_ alt_ text - crispasr_
session_ ⚠result_ word_ n_ alts - crispasr_
session_ ⚠result_ word_ p - crispasr_
session_ ⚠result_ word_ t0 - crispasr_
session_ ⚠result_ word_ t1 - crispasr_
session_ ⚠result_ word_ text - crispasr_
session_ ⚠separate - crispasr_
session_ ⚠separate_ n_ stems - crispasr_
session_ ⚠separate_ sample_ rate - crispasr_
session_ ⚠separate_ stem - crispasr_
session_ ⚠separate_ stem_ name - crispasr_
session_ ⚠set_ alt_ n - crispasr_
session_ ⚠set_ ask - crispasr_
session_ ⚠set_ beam_ size - crispasr_
session_ ⚠set_ best_ of - crispasr_
session_ ⚠set_ cfg_ weight - crispasr_
session_ ⚠set_ codec_ path - crispasr_
session_ ⚠set_ do_ sample - crispasr_
session_ ⚠set_ exaggeration - crispasr_
session_ ⚠set_ fallback_ thresholds - crispasr_
session_ ⚠set_ frequency_ penalty - crispasr_
session_ ⚠set_ g2p_ dict - crispasr_
session_ ⚠set_ grammar_ text - crispasr_
session_ ⚠set_ hotwords - crispasr_
session_ ⚠set_ instruct - crispasr_
session_ ⚠set_ length_ scale - crispasr_
session_ ⚠set_ max_ new_ tokens - crispasr_
session_ ⚠set_ max_ speech_ tokens - crispasr_
session_ ⚠set_ min_ p - crispasr_
session_ ⚠set_ min_ speech_ tokens - crispasr_
session_ ⚠set_ progress_ callback - 0.10.3+ (issue #208): register a per-session progress callback for
long-form (chunked) transcription. Fired once per finished window
with
(processed_samples, total_samples, user_data);processedis monotonic and reachestotalon the last window. Invoked on the transcribe thread. PassNone/nullcbto clear. - crispasr_
session_ ⚠set_ punc_ model - crispasr_
session_ ⚠set_ punctuation - crispasr_
session_ ⚠set_ repetition_ penalty - crispasr_
session_ ⚠set_ return_ logits - crispasr_
session_ ⚠set_ sensitivity - crispasr_
session_ ⚠set_ source_ language - crispasr_
session_ ⚠set_ speaker_ id - crispasr_
session_ ⚠set_ speaker_ identity - crispasr_
session_ ⚠set_ speaker_ name - crispasr_
session_ ⚠set_ target_ language - crispasr_
session_ ⚠set_ temperature - crispasr_
session_ ⚠set_ top_ k - crispasr_
session_ ⚠set_ top_ p - crispasr_
session_ ⚠set_ translate - crispasr_
session_ ⚠set_ tts_ noise_ temp - crispasr_
session_ ⚠set_ tts_ num_ candidates - crispasr_
session_ ⚠set_ tts_ phonemes - crispasr_
session_ ⚠set_ tts_ reference_ language - crispasr_
session_ ⚠set_ tts_ seed - crispasr_
session_ ⚠set_ tts_ steps - crispasr_
session_ ⚠set_ voice - crispasr_
session_ ⚠set_ whisper_ decode_ extras - crispasr_
session_ ⚠speech_ to_ speech - crispasr_
session_ ⚠stream_ open - crispasr_
session_ ⚠synthesize - crispasr_
session_ ⚠synthesize_ raw - crispasr_
session_ ⚠token_ text - crispasr_
session_ ⚠transcribe - crispasr_
session_ ⚠transcribe_ chunked - crispasr_
session_ ⚠transcribe_ chunked_ lang - 0.8.7+: chunked-encode transcribe (issue #208). Forces the
Parakeet backend through its bounded long-form path (overlapping
short-window transcribe-and-merge for non-JA models, streamed
encoder for the JA-only model) regardless of audio length, so long
files transcribe in bounded time AND recover the sections a single
full-length pass drops.
chunk_seconds <= 0keeps the per-model defaults; otherwise it sets the non-JA window length / the JA streamed window.overlap_seconds < 0uses the default. For non-Parakeet backends the chunk params are inert and this matchescrispasr_session_transcribe_lang. - crispasr_
session_ ⚠transcribe_ lang - 0.4.9+: language-aware session transcribe.
languageis an ISO 639-1 code or null/empty to keep the backend’s historical default. Backends that accept a source-language hint (whisper, canary, cohere, voxtral, voxtral4b) honour it; others ignore silently. - crispasr_
session_ ⚠transcribe_ vad - VAD-driven session transcribe. Runs Silero VAD on the PCM buffer, merges short / overlong speech slices, stitches them into one contiguous buffer with 0.1s silence gaps, calls the backend once, then remaps segment + word timestamps back to original-audio positions.
- crispasr_
session_ ⚠transcribe_ vad_ lang - 0.4.9+: language-aware VAD transcribe (same semantics as the
language kwarg on
crispasr_session_transcribe_lang). - crispasr_
session_ ⚠translate_ text - crispasr_
session_ ⚠translate_ text_ free - crispasr_
speaker_ ⚠cluster_ abi - Agglomerative single-linkage cosine clustering.
embeddingsis a row-majorn × dimbuffer of (ideally L2-normalized) vectors.labels_outreceives one cluster ID per input in[0, k). Returns the cluster countk, or -1 on invalid arguments. - crispasr_
speaker_ ⚠db_ count - crispasr_
speaker_ ⚠db_ enroll - crispasr_
speaker_ ⚠db_ free - crispasr_
speaker_ ⚠db_ load - crispasr_
speaker_ ⚠db_ match - crispasr_
speaker_ ⚠embedder_ dim_ abi - Output embedding dimension (e.g. 192 for TitaNet, 512 for IndexTTS-BigVGAN).
- crispasr_
speaker_ ⚠embedder_ embed_ abi - Extract one embedding.
outmust hold at leastdim()floats. Returns 1 on success, 0 if the model rejected the input. - crispasr_
speaker_ ⚠embedder_ free_ abi - crispasr_
speaker_ ⚠embedder_ make_ abi - Build a pluggable speaker embedder.
model_specis one of"auto","titanet","indextts","indextts-bigvgan","ecapa", or a.ggufpath. Returns null on failure. - crispasr_
speaker_ ⚠embedder_ name_ abi - crispasr_
stream_ ⚠close - crispasr_
stream_ ⚠feed - crispasr_
stream_ ⚠flush - crispasr_
stream_ ⚠get_ text - crispasr_
stream_ ⚠open - crispasr_
stream_ ⚠set_ live_ decode - Toggle voxtral4b live-captions decode-during-feed (PLAN #7 phase 3). No-op for backends that don’t have audio-injection prompt decode. Set BEFORE the first feed for clean semantics.
- crispasr_
text_ ⚠detect_ language - crispasr_
titanet_ ⚠cosine_ sim - crispasr_
titanet_ ⚠embed - crispasr_
titanet_ ⚠free - crispasr_
titanet_ ⚠init - crispasr_
token_ ⚠alt_ id - crispasr_
token_ ⚠alt_ p - crispasr_
token_ ⚠alt_ text - crispasr_
token_ ⚠n_ alts - crispasr_
token_ ⚠p - crispasr_
token_ ⚠t0 - crispasr_
token_ ⚠t1 - crispasr_
vad_ ⚠free - crispasr_
vad_ ⚠segments - crispasr_
vad_ ⚠slices - crispasr_
watermark_ ⚠detect - crispasr_
watermark_ ⚠embed - whisper_
context_ ⚠default_ params_ by_ ref - whisper_
free ⚠ - whisper_
free_ ⚠context_ params - whisper_
free_ ⚠params - whisper_
full ⚠ - whisper_
full_ ⚠default_ params_ by_ ref - whisper_
full_ ⚠get_ segment_ no_ speech_ prob - whisper_
full_ ⚠get_ segment_ t0 - whisper_
full_ ⚠get_ segment_ t1 - whisper_
full_ ⚠get_ segment_ text - whisper_
full_ ⚠lang_ id - whisper_
full_ ⚠n_ segments - whisper_
init_ ⚠from_ file_ with_ params - whisper_
lang_ ⚠id - whisper_
lang_ ⚠str
Type Aliases§
- Crispasr
Chat Abort Callback - Abort hook. Returns true to continue, false to abort — the
whisper_encoder_begin_callbackconvention on the ASR surface, and the opposite of ggml’s own. Called on the generating thread before each prompt batch and each sampled token, and (CPU backend only) from inside a running compute graph, so it must be cheap and non-blocking. It must not re-enter the session that registered it — the session mutex is held. - Crispasr
Chat OnToken - Fired once per detokenised UTF-8 chunk during a streaming generate. The
chunk pointer is valid only for the duration of the call.
Option<...>so a null pointer clears the callback (CNULL). - Crispasr
Progress Callback - Progress callback for long-form (chunked) transcription (issue #208).
Option<...>so a null pointer clears the callback (CNULL).