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.effects.remix(y, intervals, *, align_zeros=True)[source]

Remix an audio signal by re-ordering time intervals.

ynp.ndarray [shape=(…, t)]

Audio time series. Multi-channel is supported.

intervalsiterable of tuples (start, end)

An iterable (list-like or generator) where the i``th item ``intervals[i] indicates the start and end (in samples) of a slice of y.


If True, interval boundaries are mapped to the closest zero-crossing in y. If y is stereo, zero-crossings are computed after converting to mono.

y_remixnp.ndarray [shape=(…, d)]

y remixed in the order specified by intervals


Load in the example track and reverse the beats

>>> y, sr = librosa.load(librosa.ex('choice'))

Compute beats

>>> _, beat_frames = librosa.beat.beat_track(y=y, sr=sr,
...                                          hop_length=512)

Convert from frames to sample indices

>>> beat_samples = librosa.frames_to_samples(beat_frames)

Generate intervals from consecutive events

>>> intervals = librosa.util.frame(beat_samples, frame_length=2,
...                                hop_length=1).T

Reverse the beat intervals

>>> y_out = librosa.effects.remix(y, intervals[::-1])