Expand description
Streaming pitch-contour tracker: connect per-frame salience peaks across time.
Given the salient pitch candidates of each frame (as bin positions on the
logarithmic salience grid), link candidates in consecutive frames that stay
within a pitch-continuity tolerance into contours — time-connected pitch
trajectories. This is the streaming stage before predominant-melody selection
(melodia/predominant).
Assignment is greedy one-to-one nearest-neighbour: each candidate in frame f
extends the closest still-unclaimed contour from frame f-1 within
pitch_tol_bins; otherwise it begins a new contour. Peaks are processed in
the order given (callers should pass them salience-descending so the strongest
candidate claims first).
EPISTEMIC NOTE: contours are proposals about pitch continuity; several coexist in polyphony. No melody is chosen here.
Zero-heap hot path: the per-frame candidate bins live in a caller-owned flat buffer, and the contour id of each candidate is derived by scanning the previous frame’s already-written ids — no per-call allocation.
Functions§
- track_
contours - Link per-frame salience peaks into time-continuous pitch contours.