pub fn power_spectrum(
input: &[f32],
scratch: &mut [f32],
out_power: &mut [f32],
) -> Result<(), AudioError>Expand description
Power spectrum of N real (already-windowed) samples.
A thin wrapper over real_fft_magnitude: it produces the N/2 + 1
one-sided magnitude bins |X[k]| and then squares each in place, so
out_power[k] == |X[k]|^2.
input:Nreal samples,Na power of two.scratch: exactly2 * Nfloats, clobbered on return.out_power: at leastN/2 + 1floats; bins0..=N/2are written.
Zero-heap: all working storage is caller-supplied.
ยงErrors
AudioError::InvalidParameterifNis 0 or not a power of two.AudioError::OutputBufferTooSmallifscratchorout_powerare short.