Skip to content

Cooldowns

A wake-word model evaluates a rolling audio window. The phrase can remain in that window long enough to trigger repeatedly. Listener avoids that with a cooldown.

The default is one second:

use micro_wakeword::DEFAULT_COOLDOWN;
assert_eq!(DEFAULT_COOLDOWN.as_secs_f64(), 1.0);

During the cooldown, the listener keeps consuming audio but does not return another detection. This prevents old audio from accumulating.

Rust’s Duration supports fractional seconds:

use std::time::Duration;
use micro_wakeword::Listener;
# fn run() -> micro_wakeword::Result<()> {
let listener = Listener::config_builder("wake-word.json")?
.cooldown(Duration::from_secs_f64(0.5))
.build()?;
# Ok(()) }

You can also use Duration::from_millis(500).

# use micro_wakeword::Listener;
# fn run() -> micro_wakeword::Result<()> {
let listener = Listener::config_builder("wake-word.json")?
.cooldown(std::time::Duration::ZERO)
.build()?;
# Ok(()) }

This is useful for experiments, probability logging, or when the application already has a state machine controlling repeat activations.

Detector processes supplied audio without knowing wall-clock policy. A file might be processed faster than real time, and a voice pipeline might use media timestamps rather than the computer clock. Apply your own cooldown around low-level detections when needed.