Skip to main content

power_spectrum

Function power_spectrum 

Source
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: N real samples, N a power of two.
  • scratch: exactly 2 * N floats, clobbered on return.
  • out_power: at least N/2 + 1 floats; bins 0..=N/2 are written.

Zero-heap: all working storage is caller-supplied.

ยงErrors