Skip to main content

track_multi_pitch

Function track_multi_pitch 

Source
pub fn track_multi_pitch(
    frame_f0: &[f32],
    n_frames: usize,
    max_per_frame: usize,
    n_voices: usize,
    max_jump_semitones: f32,
    out_tracks: &mut [f32],
) -> Result<usize, AudioError>
Expand description

Track multiple concurrent pitch contours across frames.

  • frame_f0: row-major n_frames × max_per_frame buffer of per-frame F0 estimates in Hz; a 0.0 (or non-finite) slot means “no estimate”. Rows need not be sorted, and estimates may appear in any column order from frame to frame — continuity is resolved by pitch, not by column.
  • n_frames / max_per_frame: shape of frame_f0.
  • n_voices: declared maximum number of concurrent voices to track (1..=MAX_VOICES).
  • max_jump_semitones: the largest pitch step (semitones) an estimate may be from a voice’s last pitch and still continue that voice.
  • out_tracks: row-major n_voices × n_frames buffer; out_tracks[v * n_frames + f] is voice v’s F0 at frame f, or 0.0 where the voice is inactive/abstaining. Cleared on entry.

Returns the number of voices that were assigned at least one estimate.

§Errors