Torchaudio VAD reverse effect

from Torchaudio documentation, regarding the Voice Activity Detector transform (torchaudio.transforms — Torchaudio 0.11.0 documentation), it says:

“The effect can trim only from the front of the audio, so in order to trim from the back, the reverse effect must also be used.”

Well, I have a simple question: how can I apply the reverse effect? :slightly_smiling_face:

Hi @aNR0, you can try torchaudio.sox_effects.apply_effects_tensor with reverse as the effects.
For example,

effects = [
    ['reverse'],  # reverse
sample_rate = 16000
waveform = 2 * torch.rand([2, sample_rate * 1]) - 1
waveform, sample_rate = apply_effects_tensor(waveform, sample_rate, effects, channels_first=True)