Skip to content

Reset & stream boundaries

Wake-word detection is stateful. The frontend retains context and the detector retains model input rows and recent probabilities across calls.

Call reset() when continuity is broken:

detector.reset()?;
  • dropped or missing audio blocks;
  • seeking within a file;
  • switching callers, speakers, tracks, or input devices;
  • restarting a decoder;
  • starting an unrelated recording;
  • a network discontinuity.

Without a reset, the beginning of one source may be evaluated using feature history from another source. That can distort probabilities or create false activations near the boundary.

// Correct: state flows across contiguous blocks.
for block in contiguous_audio.chunks_exact(AUDIO_BLOCK_SAMPLES) {
detector.process_audio(block)?;
}
// Boundary: clear state once before an unrelated stream.
detector.reset()?;

Listener manages this automatically when it detects an internal queue overflow. Low-level Detector callers own this responsibility because only they know whether their input remains continuous.