audio
audio copied to clipboard
Division by zero in loudness calculation
🐛 Describe the bug
The following line in the functional method loudness
results in nan
value when the entire waveform is below the hardcoded loudness threshold value gamma_abs = -70
.
https://github.com/pytorch/audio/blob/69b2a0adc2ec03ab99990d7e8be3d4510438c148/src/torchaudio/functional/functional.py#L1627-L1631
An example case is while trying to find loudness of an ambient sound signal.
The threshold can probably be made configurable with mention in documentation. However, I as the method returns a LUFS value, I am unsure if a configurable threshold should be allowed. I am not very familiar with the algorithm yet, any suggestions/corrections to what I've said is most welcome.
Versions
Latest code in main
branch.