Skip to main content

Crate blazen_audio_stt

Crate blazen_audio_stt 

Source
Expand description

§blazen-audio-stt

Multi-backend speech-to-text engine crate for Blazen. Sibling to blazen-audio-tts, blazen-audio-music, and blazen-audio-codec; all four share the capability-agnostic vocabulary defined in blazen_audio.

§Surface shape

  • SttBackend: capability trait extending blazen_audio::AudioBackend that every STT engine implements.
  • SttBackendHandle<B>: typed wrapper for Rust callers; monomorphizes on the concrete backend.
  • DynSttProvider: erased wrapper (Box<dyn SttBackend>) for FFI / language-binding boundaries that cannot carry generics. See Appendix B of the PR-AUDIO plan for the dual-shape rationale.
  • SttOptions: cross-backend options (model id, language hint, sample rate, device, diarization toggle).
  • SttError: capability-agnostic error type; flattens engine-native failures into one of a small set of variants and implements From<SttError> for blazen_audio::AudioError.
  • TranscriptionResult / TranscriptionSegment: result types.
  • StreamingTranscript: per-chunk emission from the streaming SttBackend::stream surface.

§Backends

Each backend lives in backends under its own feature gate:

BackendFeatureNotes
whisper.cppwhispercppLocal CPU/GPU via the whisper-rs bindings.
candlecandlePure-Rust Whisper via candle-transformers.

Platform-specific acceleration for the whisper.cpp backend (cuda, metal, coreml) is exposed as opt-in no-op alias features — consumers wanting GPU acceleration must add whisper-rs as a direct dependency in their binary crate. See this crate’s Cargo.toml comments for the rationale.

Re-exports§

pub use error::SttError;
pub use options::SttOptions;
pub use provider::DynSttProvider;
pub use provider::SttBackendHandle;
pub use traits::StreamingTranscript;
pub use traits::SttBackend;
pub use traits::TranscriptionResult;
pub use traits::TranscriptionSegment;

Modules§

backends
Concrete SttBackend implementations.
error
Error type for the SttBackend trait surface and backend implementations.
options
Shared options for SttBackend implementations.
provider
Dual-shape provider wrappers around an SttBackend.
traits
The SttBackend trait — capability extension of blazen_audio::AudioBackend for speech-to-text engines.