analyze_frame

Function analyze_frame 

Source
pub fn analyze_frame(
    snd: &[f32],
    bufs: &mut EncoderBuffers,
    plan: &mut FftPlan,
    fft_out: &mut [Complex<f32>],
)
Expand description

Ingest one 160-sample frame and run the front-end analysis.

  • snd is the new audio frame as f32 samples in nominal [-1, 1). Callers converting from i16 should divide by 32768.0.
  • bufs is the per-stream working state; buffers are shifted and updated in place.
  • plan carries the realfft plan cache.
  • fft_out receives a complex spectrum of length FFT_LENGTH / 2 + 1 = 129. Realfft returns only the non-redundant half of the Hermitian-symmetric complex FFT; for the purposes of pitch refinement and spectral amplitude extraction that’s sufficient.

§Panics

Panics if snd.len() < FRAME or fft_out.len() != FFT_LENGTH / 2 + 1. Both are caller contracts; the downstream encoder controls both.