Implementation of ITU-R BS.1770-4 loudness algorithm in python
Project description
# pyloudnorm [](https://travis-ci.org/csteinmetz1/pyloudnorm)
Flexible audio loudness meter in Python.
Implementation of [ITU-R BS.1770-4](https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-4-201510-I!!PDF-E.pdf). <br/>
Allows control over gating block size and frequency weighting filters for additional control.
## Installation
```
# get pyloudness source
git clone https://github.com/csteinmetz1/pyloudnorm.git
# install dependancies
pip install -r requirements.txt
# run setup from new directory
python setup.py install
```
## Usage
### Find the loudness of an audio file
It's easy to measure the loudness of a wav file.
Here we use PySoundFile to read a .wav file as an ndarray.
```python
import soundfile as sf
import pyloudnorm as pyln
data, rate = sf.read("test.wav") # load audio
meter = pyln.Meter(rate) # create BS.1770 meter
loudness = meter.integrated_loudness(data) # measure loudness
```
### Loudness normalize and peak normalize audio files
Methods are included to normalize audio files to desired peak values or desired loudness.
Again we use scipy to read a wav file as an ndarray.
```python
import soundfile as sf
import pyloudnorm as pyln
# load audio
data, rate = sf.read("test.wav")
# peak normalize audio to -1 dB
peak_normalized_audio = pyln.normalize.peak(data, -1.0)
# measure the loudness first
meter = pyln.Meter(rate) # create BS.1770 meter
loudness = meter.integrated_loudness(data)
# loudness normalize audio to -12 dB LUFS
loudness_normalized_audio = pyln.normalize.loudness(data, loudness, -12.0)
```
## Dependancies
- **SciPy** ([https://www.scipy.org/](https://www.scipy.org/))
- **NumPy** ([http://www.numpy.org/](http://www.numpy.org/))
- **Matplotlib** ([https://matplotlib.org/](https://matplotlib.org/))
- **PySoundFile** ([https://github.com/bastibe/SoundFile](https://github.com/bastibe/SoundFile))
## Todo
- Add true peak measurement
- Develop unit tests - include audio files - check potential changes in loudness measurements
- Add additional filters (see [this paper](http://www.aes.org/e-lib/browse.cfm?elib=19215&rndx=851198))
- Include tests from the EBU R128 spec
- Setup documentation
Flexible audio loudness meter in Python.
Implementation of [ITU-R BS.1770-4](https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-4-201510-I!!PDF-E.pdf). <br/>
Allows control over gating block size and frequency weighting filters for additional control.
## Installation
```
# get pyloudness source
git clone https://github.com/csteinmetz1/pyloudnorm.git
# install dependancies
pip install -r requirements.txt
# run setup from new directory
python setup.py install
```
## Usage
### Find the loudness of an audio file
It's easy to measure the loudness of a wav file.
Here we use PySoundFile to read a .wav file as an ndarray.
```python
import soundfile as sf
import pyloudnorm as pyln
data, rate = sf.read("test.wav") # load audio
meter = pyln.Meter(rate) # create BS.1770 meter
loudness = meter.integrated_loudness(data) # measure loudness
```
### Loudness normalize and peak normalize audio files
Methods are included to normalize audio files to desired peak values or desired loudness.
Again we use scipy to read a wav file as an ndarray.
```python
import soundfile as sf
import pyloudnorm as pyln
# load audio
data, rate = sf.read("test.wav")
# peak normalize audio to -1 dB
peak_normalized_audio = pyln.normalize.peak(data, -1.0)
# measure the loudness first
meter = pyln.Meter(rate) # create BS.1770 meter
loudness = meter.integrated_loudness(data)
# loudness normalize audio to -12 dB LUFS
loudness_normalized_audio = pyln.normalize.loudness(data, loudness, -12.0)
```
## Dependancies
- **SciPy** ([https://www.scipy.org/](https://www.scipy.org/))
- **NumPy** ([http://www.numpy.org/](http://www.numpy.org/))
- **Matplotlib** ([https://matplotlib.org/](https://matplotlib.org/))
- **PySoundFile** ([https://github.com/bastibe/SoundFile](https://github.com/bastibe/SoundFile))
## Todo
- Add true peak measurement
- Develop unit tests - include audio files - check potential changes in loudness measurements
- Add additional filters (see [this paper](http://www.aes.org/e-lib/browse.cfm?elib=19215&rndx=851198))
- Include tests from the EBU R128 spec
- Setup documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyloudnorm-0.0.1.tar.gz
(6.1 kB
view hashes)
Built Distributions
pyloudnorm-0.0.1-py3-none-any.whl
(22.5 kB
view hashes)
pyloudnorm-0.0.1-py2-none-any.whl
(24.3 kB
view hashes)
Close
Hashes for pyloudnorm-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00a959885f27106c8bdf506f1b9d2980a11ff8b9cf7eee5580af360c9ce600f5 |
|
MD5 | 75062e124aeb111cd0d7c63400cb7926 |
|
BLAKE2b-256 | 47ac57f2b4d3deee886cad26bed35d478913ada373daec0a7ed25a4c5fea3152 |
Close
Hashes for pyloudnorm-0.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf4eeb190efcb6465fe6ec04ffaa803ec0a0a6e34534b3a00d422d2333b56e92 |
|
MD5 | 8d322b30140f01a381d609c756ade126 |
|
BLAKE2b-256 | 44e11cc83f20540e3a03d410248be56a9d590d7cb5afae8d3ae39944f23a513b |