Skip to main content

Crate crispasr_sys

Crate crispasr_sys 

Source
Expand description

Raw FFI bindings to CrispASR. Mirrors the public C API in include/whisper.h.

Structs§

CrispasrAlignResult
Opaque result handle for crispasr_align_words_abi. Must be freed with crispasr_align_result_free.
CrispasrDiarizeOptsAbi
ABI options for crispasr_diarize_segments_abi. method is a value in 0..3: 0 = Energy, 1 = Xcorr, 2 = VadTurns, 3 = Pyannote. pyannote_model_path is required for Pyannote, ignored otherwise.
CrispasrDiarizeSegAbi
ABI segment for crispasr_diarize_segments_abi. Caller fills t0_cs / t1_cs; the diarizer writes speaker (-1 if unassigned).
CrispasrMic
Opaque microphone handle returned by crispasr_mic_open. Must be freed with crispasr_mic_close. (PLAN #62d)
CrispasrSession
Opaque handle returned by crispasr_session_open.
CrispasrSessionResult
Opaque result handle returned by crispasr_session_transcribe. Must be freed with crispasr_session_result_free.
CrispasrStream
Opaque streaming-decoder handle returned by crispasr_session_stream_open. Must be freed with crispasr_stream_close. (PLAN #62)
CrispasrVadAbiOpts
Tunables for crispasr_session_transcribe_vad. Mirrors crispasr’s whisper_vad_params plus the max-chunk fallback used to bound encoder cost on long audio. Pass a null pointer to use defaults.
WhisperContext
Opaque context handle.
WhisperContextParams
Opaque context params handle.
WhisperFullParams
Opaque params handle (allocated by whisper_full_default_params_by_ref).
WhisperState
Opaque state handle.

Constants§

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_model path — 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 with crispasr_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_detect_backend_from_gguf
crispasr_detect_language
crispasr_detect_language_pcm
Shared language identification (0.4.6+). method is 0 for whisper, 1 for silero. model_path is required. Fills out_lang_buf with 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 segs against the cached posteriors. slice_t0_cs is 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_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_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_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_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_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); processed is monotonic and reaches total on the last window. Invoked on the transcribe thread. Pass None/null cb to clear.
crispasr_session_set_punc_model
crispasr_session_set_punctuation
crispasr_session_set_repetition_penalty
crispasr_session_set_return_logits
crispasr_session_set_source_language
crispasr_session_set_speaker_id
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_seed
crispasr_session_set_tts_steps
crispasr_session_set_voice
crispasr_session_set_whisper_decode_extras
crispasr_session_stream_open
crispasr_session_synthesize
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 <= 0 keeps the per-model defaults; otherwise it sets the non-JA window length / the JA streamed window. overlap_seconds < 0 uses the default. For non-Parakeet backends the chunk params are inert and this matches crispasr_session_transcribe_lang.
crispasr_session_transcribe_lang
0.4.9+: language-aware session transcribe. language is 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. embeddings is a row-major n × dim buffer of (ideally L2-normalized) vectors. labels_out receives one cluster ID per input in [0, k). Returns the cluster count k, 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. out must hold at least dim() 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_spec is one of "auto", "titanet", "indextts", "indextts-bigvgan", "ecapa", or a .gguf path. 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
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§

CrispasrProgressCallback
Progress callback for long-form (chunked) transcription (issue #208). Option<...> so a null pointer clears the callback (C NULL).