Skip to main content

segment_notes

Function segment_notes 

Source
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 (default 440.0).
  • min_note_frames: minimum note length in frames; shorter runs are dropped (a value of 0 is treated as 1).
  • out: caller-owned destination for the note events.

Returns the number of notes written into out.

§Errors