Skip to main content

Module segmenter

Module segmenter 

Source
Expand description

Segment a mono signal into voiced regions with hysteresis and hangover.

A raw per-frame decision (crate::features::vad::frame_is_voiced) chatters at speech onsets/offsets and on brief dropouts (stops, glottal gaps). This module turns the frame-level proposal stream into stable [start, end) frame-index segments using two duration guards:

  • min-speech (onset debounce): a run of voiced frames must reach a minimum length before a segment opens, rejecting isolated spurious frames.
  • min-silence (hangover): once open, a segment only closes after a sustained run of unvoiced frames, so a short dropout inside speech does not split it.

The noise floor is adaptive and streamed online: a fixed stack ring of the most recent per-frame energies feeds crate::features::vad::noise_floor_min_stat, so the floor tracks the quiet frames without any heap allocation.

EPISTEMIC RULE: output segments are proposals. Frames at or below the adaptive floor stay unvoiced — silence is never coerced into a segment.

Functions§

segment_voiced
Detect voiced segments in signal, writing [start_frame, end_frame) index pairs into out_segments.