pub fn build_mel_bank(
n_fft_bins: usize,
n_mel: usize,
sample_rate: f32,
fmin: f32,
fmax: f32,
weights_out: &mut [f32],
) -> Result<(), AudioError>Expand description
Build a triangular mel filterbank as a row-major n_mel × n_fft_bins table of
weights, written into weights_out.
n_fft_bins: number of magnitude/power bins per frame (n_fft/2 + 1).n_mel: number of mel filters (rows).sample_rate: sampling rate in Hz (used to map each FFT bin to a frequency).fmin/fmax: passband edges in Hz (fmax <= 0or above Nyquist → Nyquist).weights_out: at leastn_mel * n_fft_binsfloats; fully overwritten.
Each filter m rises linearly from its lower edge to its centre (peak 1.0),
then falls to its upper edge; centres are equally spaced in mel between fmin
and fmax, so adjacent triangles share an edge and overlap. Weights are
non-negative. Returns AudioError::InvalidParameter on degenerate sizes /
rates and AudioError::OutputBufferTooSmall if weights_out is short.