pytorch / audio

Data manipulation and transformation for audio signal processing, powered by PyTorch
https://pytorch.org/audio
BSD 2-Clause "Simplified" License
2.55k stars 655 forks source link

Division by zero in loudness calculation #3815

Closed dhanvanth-pk-13760 closed 4 months ago

dhanvanth-pk-13760 commented 4 months ago

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.