1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! # memo-stt
//!
//! Plug-and-play, local speech-to-text for Rust applications.
//!
//! `memo-stt` wraps [`whisper-rs`](https://crates.io/crates/whisper-rs) behind a
//! small, three-method API and handles model download and platform GPU
//! acceleration automatically so you can add transcription to any Rust app
//! without configuration.
//!
//! ## Quick example
//!
//! ```no_run
//! use memo_stt::SttEngine;
//!
//! # fn run(audio_samples: &[i16]) -> Result<(), Box<dyn std::error::Error>> {
//! let mut engine = SttEngine::new_default(16000)?;
//! engine.warmup()?;
//! let text = engine.transcribe(audio_samples)?;
//! println!("Transcribed: {}", text);
//! # Ok(())
//! # }
//! ```
//!
//! On the first call, the default model (`ggml-small.en-q5_1.bin`, ~500 MB) is
//! downloaded into the platform cache directory. Every subsequent run is
//! fully offline.
//!
//! ## Recommended model
//!
//! Use the default `ggml-small.en-q5_1.bin` for almost every use case. It is
//! the best general-purpose balance of speed, size, and accuracy for English
//! speech. Only pick a larger distil model if you specifically need higher
//! accuracy on noisy audio or accented speech.
//!
//! ## Features
//!
//! - Zero configuration — model is auto-downloaded on first use.
//! - Automatic GPU acceleration where supported (Metal on macOS, CUDA on
//! Linux/Windows when available); clean CPU fallback otherwise.
//! - Three-method API: [`SttEngine::new_default`], [`SttEngine::warmup`],
//! [`SttEngine::transcribe`].
//! - Fully local — audio never leaves the machine.
//! - Cross-platform: macOS, Linux, Windows.
//!
//! ## Installation
//!
//! ```toml
//! [dependencies]
//! memo-stt = "0.1"
//! ```
//!
//! ## Audio format
//!
//! `memo-stt` expects 16-bit signed PCM mono samples (`&[i16]`). The input
//! sample rate is whatever you declare to [`SttEngine::new`] /
//! [`SttEngine::new_default`]; samples are resampled to 16 kHz internally.
//!
//! ## Standalone binary
//!
//! A CLI with hotkey, microphone, and BLE-device support is available behind
//! the `binary` feature:
//!
//! ```bash
//! cargo install memo-stt --features binary
//! ```
pub use SttEngine;
pub use ;
/// Default Whisper model name (`small.en` Q5_1).
///
/// This is the recommended general-purpose model and is downloaded
/// automatically on first use.
pub const DEFAULT_MODEL: &str = "ggml-small.en-q5_1.bin";
/// Error type used throughout the crate.
;
/// Convenience `Result` alias used throughout the crate.
pub type Result<T> = Result;