pyloudnorm

Flexible audio loudness meter in Python with implementation of ITU-R BS.1770-4 loudness algorithm

https://github.com/csteinmetz1/pyloudnorm

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 7 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Flexible audio loudness meter in Python with implementation of ITU-R BS.1770-4 loudness algorithm

Basic Info
Statistics
  • Stars: 718
  • Watchers: 15
  • Forks: 57
  • Open Issues: 16
  • Releases: 2
Created over 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

pyloudnorm Build Status Zenodo

Flexible audio loudness meter in Python.

Implementation of ITU-R BS.1770-4.
Allows control over gating block size and frequency weighting filters for additional control.

For full details on the implementation see our paper with a summary in our AES presentation video.

Installation

You can install with pip as follows pip install pyloudnorm

For the latest releases always install from the GitHub repo pip install git+https://github.com/csteinmetz1/pyloudnorm

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 (with shape (samples, channels)) 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. ```python import soundfile as sf import pyloudnorm as pyln

data, rate = sf.read("test.wav") # load audio

peak normalize audio to -1 dB

peaknormalizedaudio = 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

loudnessnormalizedaudio = pyln.normalize.loudness(data, loudness, -12.0) ```

Advanced operation

A number of alternate weighting filters are available, as well as the ability to adjust the analysis block size. Examples are shown below. ```python import soundfile as sf import pyloudnorm as pyln from pyloudnorm import IIRfilter

data, rate = sf.read("test.wav") # load audio

block size

meter1 = pyln.Meter(rate) # 400ms block size meter2 = pyln.Meter(rate, block_size=0.200) # 200ms block size

filter classes

meter3 = pyln.Meter(rate) # BS.1770 meter meter4 = pyln.Meter(rate, filterclass="DeMan") # fully compliant filters
meter5 = pyln.Meter(rate, filter
class="Fenton/Lee 1") # low complexity improvement by Fenton and Lee meter6 = pyln.Meter(rate, filterclass="Fenton/Lee 2") # higher complexity improvement by Fenton and Lee meter7 = pyln.Meter(rate, filterclass="Dash et al.") # early modification option

create your own IIR filters

myhighpass = IIRfilter(0.0, 0.5, 20.0, rate, 'highpass') myhighshelf = IIRfilter(2.0, 0.7, 1525.0, rate, 'highshelf')

create a meter initialized without filters

meter8 = pyln.Meter(rate, filter_class="custom")

load your filters into the meter

meter8.filters = {'myhighpass' : myhighpass, 'myhighshelf' : myhigh_shelf}

```

Dependencies

Citation

If you use pyloudnorm in your work please consider citing us. @inproceedings{steinmetz2021pyloudnorm, title={pyloudnorm: {A} simple yet flexible loudness meter in Python}, author={Steinmetz, Christian J. and Reiss, Joshua D.}, booktitle={150th AES Convention}, year={2021}}

References

Ian Dash, Luis Miranda, and Densil Cabrera, "Multichannel Loudness Listening Test," 124th International Convention of the Audio Engineering Society, May 2008

Pedro D. Pestana and Álvaro Barbosa, "Accuracy of ITU-R BS.1770 Algorithm in Evaluating Multitrack Material," 133rd International Convention of the Audio Engineering Society, October 2012

Pedro D. Pestana, Josh D. Reiss, and Álvaro Barbosa, "Loudness Measurement of Multitrack Audio Content Using Modifications of ITU-R BS.1770," 134th International Convention of the Audio Engineering Society, May 2013

Steven Fenton and Hyunkook Lee, "Alternative Weighting Filters for Multi-Track Program Loudness Measurement," 143rd International Convention of the Audio Engineering Society, October 2017

Brecht De Man, "Evaluation of Implementations of the EBU R128 Loudness Measurement," 145th International Convention of the Audio Engineering Society, October 2018.

Tensorized/Differentiable Implementations

For use in differentiable contexts, such as part of a loss function, there are the following implementations: - PyTorch: Descript Inc.'s audiotools - Jax: jaxloudnorm

Owner

  • Name: Christian J. Steinmetz
  • Login: csteinmetz1
  • Kind: user
  • Location: London, UK
  • Company: @aim-qmul

Machine learning for Hi-Fi audio. PhD Researcher at C4DM.

GitHub Events

Total
  • Watch event: 74
  • Fork event: 2
Last Year
  • Watch event: 74
  • Fork event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 93
  • Total Committers: 7
  • Avg Commits per committer: 13.286
  • Development Distribution Score (DDS): 0.097
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
csteinmetz1 c****1@g****m 84
Stephen Russell S****l@g****m 4
boris b****v@m****g 1
PluieElectrique 4****e 1
Keunwoo Choi g****b@g****m 1
Yulin Li Y****i@m****m 1
Christian Steinmetz c****z@3****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 34
  • Total pull requests: 29
  • Average time to close issues: 4 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 25
  • Total pull request authors: 7
  • Average comments per issue: 1.88
  • Average comments per pull request: 0.14
  • Merged pull requests: 27
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • csteinmetz1 (5)
  • schtschenok (4)
  • f-brinkmann (2)
  • rawrbw (2)
  • alisonbma (1)
  • kwanUm (1)
  • Franky1 (1)
  • zuowanbushiwo (1)
  • RBBlackstone (1)
  • faroit (1)
  • Mistobaan (1)
  • smros (1)
  • oplatek (1)
  • thesby (1)
  • ghost (1)
Pull Request Authors
  • csteinmetz1 (20)
  • cwu307 (2)
  • StphnRssll (2)
  • boris-kuz (2)
  • yulin-li (1)
  • PluieElectrique (1)
  • keunwoochoi (1)
Top Labels
Issue Labels
enhancement (1) help wanted (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 1,333,102 last-month
  • Total docker downloads: 773
  • Total dependent packages: 8
    (may contain duplicates)
  • Total dependent repositories: 198
    (may contain duplicates)
  • Total versions: 5
  • Total maintainers: 1
pypi.org: pyloudnorm

Implementation of ITU-R BS.1770-4 loudness algorithm in Python.

  • Versions: 3
  • Dependent Packages: 8
  • Dependent Repositories: 198
  • Downloads: 1,333,102 Last month
  • Docker Downloads: 773
Rankings
Dependent repos count: 1.1%
Downloads: 1.4%
Dependent packages count: 1.6%
Average: 2.6%
Stargazers count: 2.8%
Docker downloads count: 2.8%
Forks count: 5.7%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/csteinmetz1/pyloudnorm
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 6.9%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • future >=0.16.0
  • matplotlib >=2.1.1
  • numpy >=1.14.2
  • pysoundfile >=0.9.0
  • scipy >=1.0.1
setup.py pypi
  • future >=0.16.0
  • numpy >=1.14.2
  • scipy >=1.0.1
.github/workflows/publish-to-test-pypi.yml actions
  • actions/checkout master composite
  • actions/setup-python v1 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi