audio icon indicating copy to clipboard operation
audio copied to clipboard

Vol silently clamps outputs to range [-1,1]

Open CookiePPP opened this issue 1 year ago • 0 comments

📚 The doc issue

https://pytorch.org/audio/stable/generated/torchaudio.transforms.Vol.html

The current doc for torchaudio.transforms.Vol just says "Adjust volume of waveform." but it also clamps the output using torch.clamp(waveform, -1, 1) which can be hard to realise and debug (in my case, I have millions of audio files and around 10% of them had enough dynamic range to trigger this clipping, making it harder to reproduce, but still enough files to cause audio quality issues and disrupt training stability).

Suggest a potential alternative/fix

I would suggest adding a warning to the method that prints once if an output waveform has samples that will be clamped and updating the torchaudio doc to make it clear that the function clamps the output.

CookiePPP avatar Jan 16 '24 13:01 CookiePPP