Skip to content

Reverse

Added in v0.18.0

Reverse the audio, also known as time inversion. Inversion of an audio track along its time axis is analogous to the random flip of an image, an augmentation technique widely used in the visual domain. This can be relevant in the context of audio classification. It was successfully applied in the paper AudioCLIP: Extending CLIP to Image, Text and Audio .

Input-output example

In this example, we reverse a speech recording

Input-output waveforms and spectrograms

Input sound Transformed sound

Usage example

from audiomentations import Reverse

transform = Reverse(p=1.0)

augmented_sound = transform(my_waveform_ndarray, sample_rate=44100)

Reverse API

p: float • range: [0.0, 1.0]
Default: 0.5. The probability of applying this transform.

Source code

audiomentations/augmentations/reverse.py