Skip to main content

overlap_add

Function overlap_add 

Source
pub fn overlap_add(
    frames: &[f32],
    frame_size: usize,
    hop: usize,
    out: &mut [f32],
) -> Result<usize, AudioError>
Expand description

Overlap-add frames into out with stride hop.

  • frames: num_frames × frame_size concatenated frame samples (row-major, frame i occupies frames[i*frame_size .. (i+1)*frame_size]). Already windowed by the caller if a window is desired.
  • frame_size: samples per frame (> 0); frames.len() must be a whole multiple of it.
  • hop: sample advance between consecutive frames (> 0).
  • out: receives the summed signal; must hold at least the returned length.

Returns the number of output samples written, (num_frames − 1) × hop + frame_size. The used region of out is zeroed before accumulation, so stale contents do not leak in.

Errors: AudioError::InvalidParameter for a zero frame_size/hop or a frames length that is not a multiple of frame_size; AudioError::OutputBufferTooSmall if out cannot hold the result.