Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.2.
librosa.blocks_to_frames
- librosa.blocks_to_frames(blocks, block_length)[source]
Convert block indices to frame indices
- Parameters:
- blocksnp.ndarray
Block index or array of block indices
- block_lengthint > 0
The number of frames per block
- Returns:
- framesnp.ndarray [shape=samples.shape, dtype=int]
The index or indices of frames corresponding to the beginning of each provided block.
See also
Examples
Get frame indices for each block in a stream
>>> filename = librosa.ex('brahms') >>> sr = librosa.get_samplerate(filename) >>> stream = librosa.stream(filename, block_length=16, ... frame_length=2048, hop_length=512) >>> for n, y in enumerate(stream): ... n_frame = librosa.blocks_to_frames(n, block_length=16)