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
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 details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyloudnorm-0.0.1.tar.gz.
File metadata
- Download URL: pyloudnorm-0.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3703d0f3e004e02587972141b22bcfbabe17fa774c176d42cd36902fb0ad938
|
|
| MD5 |
654ac4f030b5d0878071592318500a39
|
|
| BLAKE2b-256 |
08b99785e861dbcb13b77acb06acd6e9f876f9445cc7a41737397480312a4a16
|
File details
Details for the file pyloudnorm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyloudnorm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a959885f27106c8bdf506f1b9d2980a11ff8b9cf7eee5580af360c9ce600f5
|
|
| MD5 |
75062e124aeb111cd0d7c63400cb7926
|
|
| BLAKE2b-256 |
47ac57f2b4d3deee886cad26bed35d478913ada373daec0a7ed25a4c5fea3152
|
File details
Details for the file pyloudnorm-0.0.1-py2-none-any.whl.
File metadata
- Download URL: pyloudnorm-0.0.1-py2-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf4eeb190efcb6465fe6ec04ffaa803ec0a0a6e34534b3a00d422d2333b56e92
|
|
| MD5 |
8d322b30140f01a381d609c756ade126
|
|
| BLAKE2b-256 |
44e11cc83f20540e3a03d410248be56a9d590d7cb5afae8d3ae39944f23a513b
|