Skip to main content

Module multi_melodia

Module multi_melodia 

Source
Expand description

Multi-voice pitch-contour tracking (polyphonic extension of Melodia).

Melodia’s mono predominant-melody stage collapses each frame to a single F0 and threads it through time. Polyphonic material has several concurrent lines, so this tracker takes the per-frame multi-pitch estimates (e.g. from super::multipitch_klapuri, one row of F0s per analysis frame) and threads them into up to n_voices continuous pitch tracks by nearest-pitch continuity — the many-voices analogue of contour tracking.

EPISTEMIC RULE (declared): the tracks are proposals. The max-polyphony assumption is explicit in n_voices: at most that many concurrent lines are posited, and when a frame offers more estimates than free voices the surplus is dropped rather than forced onto an unrelated voice. A voice with no matching estimate in a frame abstains for that frame (0.0), and is freed after MAX_GAP silent frames so a genuinely new line can reuse the slot. Zero input estimates → zero tracks.

Zero-heap hot path: all per-voice / per-estimate state lives in fixed stack arrays bounded by MAX_VOICES / MAX_ESTIMATES; the caller owns the frame_f0 input and the out_tracks output. Nothing is allocated.

Constants§

MAX_ESTIMATES
Upper bound on per-frame F0 estimates (stack-array sizing).
MAX_GAP
Consecutive unmatched frames after which a voice is freed for reuse.
MAX_VOICES
Upper bound on concurrent voices (stack-array sizing).

Functions§

track_multi_pitch
Track multiple concurrent pitch contours across frames.