Skip to main content

Module contour_segmentation

Module contour_segmentation 

Source
Expand description

Segment a pitch contour into note-like events (stable-pitch runs).

A melody contour (a per-frame sequence of pitch positions, in salience bins) is carved into notes: maximal runs of frames that stay near a common pitch. A note ends when the pitch departs from the run’s running mean by more than a tolerance, or when the contour goes unvoiced (a 0.0 sentinel). Very short runs (below min_note_frames) are discarded as transients/glides.

EPISTEMIC NOTE: notes are proposals about how a continuous pitch track quantises into discrete events; the pitch value reported per note is the mean over its frames, not a snapped scale degree (no tuning system is assumed here).

Zero-heap hot path: reads a caller-owned bin sequence and writes note events into caller-owned output slices; allocates nothing.

Functions§

segment_contour
Segment contour_bins[0..n_points] into stable-pitch note events.