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
//! Wake word detection for the voice assistant pipeline.
//!
//! A wake word is a short phrase (e.g. "hey assistant", "ok computer") that
//! activates the voice assistant from idle. Two backends are supported:
//!
//! - [`RustpotterDetector`] — pure-Rust, Apache 2.0, no native deps.
//! Uses DTW or ONNX neural models (`.rpw` files). Feature: `wake-word`.
//!
//! - [`PorcupineDetector`] — Picovoice Porcupine, maximum accuracy.
//! Requires a free AccessKey and the native Porcupine library.
//! Feature: `wake-word-porcupine`.
//!
//! ## Quick start
//!
//! ```rust,no_run,ignore
//! use brainwires_hardware::audio::wake_word::{RustpotterDetector, WakeWordDetector};
//!
//! // Load a .rpw model (record samples with rustpotter-cli to create one)
//! let mut detector = RustpotterDetector::from_model_file("hey_assistant.rpw", 0.5).unwrap();
//! println!("Feed {} i16 samples per frame", detector.frame_size());
//! ```
/// Energy-burst wake trigger — zero-dependency fallback.
pub use EnergyTriggerDetector;
pub use PorcupineDetector;
pub use RustpotterDetector;
/// A wake word detection event.
/// A stateful detector that processes fixed-size audio frames and fires on
/// keyword detection.
///
/// All implementations expect 16 kHz mono i16 PCM. Use
/// [`crate::audio::vad::pcm_to_i16_mono`] to convert an `AudioBuffer` first.