A Python package (battle-tested C++ under the hood) for calculating integrated loudness (LUFS) with the ITU BS.1770 loudness algorithm. Useful for EBU R 128 compliance. Takes NumPy arrays as input (supports mono and stereo/multichannel). Based on libloudness (original implementation by Magnus Bro Kolstø, Nomono).
pip install loudness
import soundfile as sf
import loudness
audio, sr = sf.read("audio.wav", dtype="float32") # shape (samples, channels)
lufs = loudness.integrated_loudness(audio, sr)
print(f"{lufs:.2f} LUFS")
loudness is significantly faster than the alternatives:
Initial release
For the complete changelog, go to CHANGELOG.md
- Install CMake and a C++ compiler
pip install numpy pybind11 build scikit-build-core
python -m build --wheel
- Install the built wheel
pytest