pub fn predominant_melody(
salience_frames: &[f32],
n_frames: usize,
n_bins: usize,
f_min_hz: f32,
bins_per_semitone: f32,
out_f0: &mut [f32],
) -> Result<usize, AudioError>Expand description
Estimate the predominant fundamental frequency of each frame.
salience_frames is a flat row-major buffer of shape n_frames × n_bins
(salience_frames[f * n_bins + b]) on the logarithmic grid where bin b is
f_min_hz * 2^(b / (12 * bins_per_semitone)). For each frame the strongest
bin is found, parabolically refined, and converted to Hz; frames whose peak
salience is below VOICING_RATIO of the whole excerpt’s peak salience abstain
with out_f0 = 0.0.
Returns the number of voiced frames (non-zero out_f0).
§Errors
AudioError::InvalidParameterifn_bins < 3,f_min_hz/bins_per_semitoneare not positive finite, orsalience_frames.len() < n_frames * n_bins.AudioError::OutputBufferTooSmallifout_f0.len() < n_frames.