Skip to main content

frame_count

Function frame_count 

Source
pub fn frame_count(signal_len: usize, frame_size: usize, hop: usize) -> usize
Expand description

Number of complete frames of length frame_size obtainable from a signal of signal_len samples advancing by hop each step.

Matches the standard STFT geometry (signal_len − frame_size) / hop + 1 when the signal is at least one frame long, and 0 otherwise. Partial trailing frames (fewer than frame_size samples) are not counted.

A hop of 0 is meaningless (frames never advance); it returns 0 rather than looping forever. A frame_size of 0 also returns 0.