pub fn hpcp(
peak_freqs: &[f32],
peak_mags: &[f32],
n_peaks: usize,
ref_freq_hz: f32,
n_pc: usize,
out: &mut [f32],
) -> Result<(), AudioError>Expand description
Accumulate spectral peaks into a Harmonic Pitch Class Profile.
peak_freqs/peak_mags: parallel arrays of peak frequency (Hz) and magnitude, e.g. fromcrate::features::peaks::spectral_peaks().n_peaks: how many leading entries of those arrays to use (clamped to the shorter of the two).ref_freq_hz: tuning reference frequency (frequency of A4); parameterised, default-by-convention 440 Hz — never assume it.n_pc: pitch classes per octave (12 for 12-TET; any≥ 1accepted).out: destination profile; the firstn_pcentries are overwritten with the accumulated magnitudes (raw, not normalised).
§Errors
AudioError::InvalidParameterifref_freq_hzis not positive-finite, orn_pc == 0.AudioError::OutputBufferTooSmallifout.len() < n_pc.