Expand description
Reference tuning estimation from spectral peaks — does not assume 440 Hz.
Given peak frequencies, we measure how far each sits from an equal-tempered
semitone grid anchored at a nominal reference, then take the magnitude-
weighted circular mean of those deviations (deviations wrap at ±50 cents,
so a plain average would be wrong). The resulting global deviation recovers the
true tuning reference: ref = nominal * 2^(deviation_cents / 1200).
The nominal anchor is a parameter, so nothing here hardcodes 440 Hz as truth — it is only the grid we measure against, and the estimate is free to land anywhere (432, 415, 443, …).
Zero-heap: a single streaming pass over the peaks; no allocation.
Structs§
- Tuning
Estimate - Estimated tuning: the recovered reference frequency and its deviation from the
nominal anchor, plus a confidence in
[0, 1](resultant-vector concentration — high when peaks agree on one tuning, low for noise / inharmonic material).
Functions§
- estimate_
tuning - Estimate the reference tuning frequency from spectral peaks.