Expand description
Harmonic pitch-salience function over a cent/bin grid (Melodia-class).
Given the spectral peaks of one frame (peak_freqs, peak_mags), accumulate a
pitch-salience curve onto a logarithmic (constant-cents) frequency grid.
Each spectral peak at frequency f_i is treated as the possible h-th
harmonic of a fundamental f0 = f_i / h for h = 1..N_HARMONICS, so it casts
a weighted vote onto the salience bin of every such candidate fundamental. A
fundamental that actually generated a harmonic series therefore collects votes
from all of its harmonics and dominates the curve.
EPISTEMIC NOTE: the salience curve is a proposal about where pitched energy
plausibly sits; it commits to no monophonic/polyphonic reading — a polyphonic
frame yields several salient ridges. Downstream selection
(predominant/melodia) is where a mono-vs-poly assumption is declared.
Zero-heap hot path: the caller owns out_salience (length ≥ n_bins); the
function clears and fills it in place and allocates nothing.
Functions§
- pitch_
salience - Accumulate a harmonic pitch-salience curve from the frame’s spectral peaks.