Skip to main content

real_fft_magnitude

Function real_fft_magnitude 

Source
pub fn real_fft_magnitude(
    input: &[f32],
    scratch: &mut [f32],
    out_mags: &mut [f32],
) -> Result<(), AudioError>
Expand description

Forward FFT of N real samples, writing the magnitude of the first N/2 + 1 bins (the non-redundant half for real input).

  • input: N real samples, N a power of two.
  • scratch: exactly 2 * N floats; used as interleaved complex work space and clobbered on return.
  • out_mags: at least N/2 + 1 floats; magnitudes |X[k]| for k = 0..=N/2 are written into the first N/2 + 1 slots.

Returns AudioError::InvalidParameter if N is 0 or not a power of two, or AudioError::OutputBufferTooSmall if scratch or out_mags are short.