pub fn segment_contour(
contour_bins: &[f32],
n_points: usize,
stable_tol_bins: f32,
min_note_frames: usize,
out_start: &mut [usize],
out_len: &mut [usize],
out_pitch: &mut [f32],
) -> Result<usize, AudioError>Expand description
Segment contour_bins[0..n_points] into stable-pitch note events.
contour_bins[i] is the pitch of frame i on the salience grid (any
monotonic pitch scale in units where stable_tol_bins is meaningful); a value
of 0.0 marks an unvoiced frame that cannot belong to a note. A note is a run
whose every frame lies within stable_tol_bins of the run’s running mean; the
run closes when a frame breaks that bound or is unvoiced. Runs of at least
min_note_frames frames are emitted:
out_start[k]: first frame index of notek.out_len[k]: number of frames in notek.out_pitch[k]: mean pitch (bins) over notek.
Returns the number of notes written.
§Errors
AudioError::InvalidParameterifstable_tol_binsis not a finite non-negative value,min_note_frames == 0, orcontour_bins.len() < n_points.AudioError::OutputBufferTooSmallif more notes are found than any of the output slices can hold.