Skip to main content

cut_frame

Function cut_frame 

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

Copy frame index of a signal (window position index * hop) into out.

  • signal: the source samples.
  • frame_size: number of samples per frame; out must be at least this long.
  • hop: sample advance between consecutive frames.
  • index: which frame to extract (0-based).

Only the first frame_size slots of out are written. Returns AudioError::InvalidParameter for a zero frame_size/hop or if the requested frame runs past the end of signal, and AudioError::OutputBufferTooSmall if out is shorter than frame_size.