pub fn griffin_lim(
target_mags: &[f32],
spectra: &mut [f32],
fft_size: usize,
hop: usize,
iterations: usize,
analysis_window: &[f32],
synthesis_window: &[f32],
ifft_scratch: &mut [f32],
norm: &mut [f32],
out: &mut [f32],
) -> Result<usize, AudioError>Expand description
Run iterations Griffin-Lim rounds and write the reconstructed time signal.
target_mags:num_frames × (N/2 + 1)non-negative magnitude targets, frameiattarget_mags[i*(N/2+1) .. (i+1)*(N/2+1)].spectra:num_frames × 2Ninterleaved-complex working buffer, seeded by the caller with an initial estimate (typicallytarget magnitude × e^{jφ}for some initial phase φ, Hermitian-symmetric). Updated in place;num_frames = spectra.len() / (2N).fft_size:N, a power of two.hop: sample advance between frames (> 0).iterations: number of projection rounds (0just inverts the seed).analysis_window/synthesis_window: length-Nwindows (WOLA pair).ifft_scratch:≥ Nfloats (clobbered).norm:≥ out_lenfloats, ISTFT normalisation scratch (clobbered).out:≥ out_lenfloats; receives the reconstruction, whereout_len = (num_frames − 1)·hop + N.
Returns out_len. Errors mirror istft, plus
AudioError::InvalidParameter if target_mags.len() does not equal
num_frames × (N/2 + 1).