pub fn segment_notes(
f0_hz: &[f32],
confidence: &[f32],
n_frames: usize,
ref_a4_hz: f32,
min_note_frames: usize,
out: &mut [NoteEvent],
) -> Result<usize, AudioError>Expand description
Segment a per-frame pitch track into note events.
f0_hz: per-frame fundamental in Hz (0.0= unvoiced). Length ≥n_frames.confidence: per-frame voicing confidence in[0, 1]. Length ≥n_frames.n_frames: number of valid frames to read from the two tracks.ref_a4_hz: reference tuning for A4 (default440.0).min_note_frames: minimum note length in frames; shorter runs are dropped (a value of0is treated as1).out: caller-owned destination for the note events.
Returns the number of notes written into out.
§Errors
AudioError::InvalidParameterif either input track is shorter thann_frames, orref_a4_hzis not positive/finite.AudioError::OutputBufferTooSmallifoutcannot hold every note.