overlapping_frames

emlib.numpytools.overlapping_frames(y, frame_length, hop_length)[source]

Slice a time series into overlapping frames.

Parameters:
  • y (ndarray) – np.ndarray - Time series to frame, Must be one-dimensional and contiguous in memory

  • frame_length (int) – int - Length of the frame in samples

  • hop_length (int) – int - Number of samples to hop between frames

Return type:

ndarray

Returns:

the frames, a np.ndarray of shape=(frame_length, N_FRAMES)

Examples

# Extract 2048-sample frames from y with a hop of 64 samples # per frame >>> samples, sr = sndread(“monofile.wav”) >>> overlapping_frames(samples, frame_length=2048, hop_length=64)

NB: Taken from librosa.util.frame