pub fn segment_voiced(
signal: &[f32],
frame_len: usize,
hop: usize,
sample_rate: u32,
out_segments: &mut [(u32, u32)],
) -> Result<usize, AudioError>Expand description
Detect voiced segments in signal, writing [start_frame, end_frame) index
pairs into out_segments.
signal: mono samples in[-1, 1](or any linear scale).frame_len: analysis window length in samples (power-of-two enables the spectral-flatness cue; seecrate::features::vad::frame_voicing_score).hop: advance between frame starts in samples.sample_rate: used only to convert the hysteresis durations to frames.out_segments: caller-owned output; each entry is(start_frame, end_frame)withendexclusive, in frame-index units.
Returns the number of segments written.
ยงErrors
AudioError::InvalidParameterifframe_lenorhopis zero.AudioError::OutputBufferTooSmallif there are more segments thanout_segmentscan hold (segments written so far are left in place).
Zero-heap: a single streaming pass over signal; the only working state is a
fixed stack ring for the adaptive noise floor.