Audio library for modelling loudness

Related tags

Audio loudness
Overview

Loudness

Loudness is a C++ library with Python bindings for modelling perceived loudness. The library consists of processing modules which can be cascaded to form a loudness model.

Dependencies

To build the C++ library you will need:

  • libsndfile1-dev >= 1.0.25
  • libfftw3-dev >= 3.3.3
  • zlib1g-dev >= 1.2.8

To build the Python bindings you will need:

  • swig >= 3.0.0
  • python-numpy-dev

Note

This project is still in heavy development so is not stable. I am also now only supporting Python 3.5+. Please register an issue at: https://github.com/deeuu/loudness/issues

Acknowledgments

The library interface is based on the fantastic AIM-C: https://code.google.com/p/aimc/

The cnpy library for reading numpy arrays in C++: https://github.com/rogersce/cnpy

Ricard Marxer for the loudia audio project: https://github.com/rikrd/loudia

Example - Loudness of a 1 kHz tone @ 40 dB SPL according to ANSI S3.4:2007

import loudness as ln

# All inputs and outputs make use of a SignalBank
inputBank = ln.SignalBank()
nSources = 1
nEars = 1
nChannels = 1
nSamples = 1
fs = 1

# There are 4 dimensions
inputBank.initialize(nSources, nEars, nChannels, nSamples, fs)

# Set the centre frequency of the first channel
inputBank.setCentreFreq(0, 1000)

# Set the intensity in normalised units
level = 40
inputBank.setSample(0, 0, 0, 0, 10.0 ** (level / 10.0))

# The loudness model
model = ln.StationaryLoudnessANSIS342007()
model.initialize(inputBank)

# Now process the input
model.process(inputBank)

# Get the output of this loudness model
feature = 'Loudness'
outputBank = model.getOutput(feature)

print 'Loudness in sones %0.2f' % outputBank.getSample(0, 0, 0, 0)
You might also like...
a library for audio and music analysis

aubio aubio is a library to label music and sounds. It listens to audio signals and attempts to detect events. For instance, when a drum is hit, at wh

C++ library for audio and music analysis, description and synthesis, including Python bindings

Essentia Essentia is an open-source C++ library for audio analysis and audio-based music information retrieval released under the Affero GPL license.

LibXtract is a simple, portable, lightweight library of audio feature extraction functions.

LibXtract LibXtract is a simple, portable, lightweight library of audio feature extraction functions. The purpose of the library is to provide a relat

A library for augmenting annotated audio data

muda A library for Musical Data Augmentation. muda package implements annotation-aware musical data augmentation, as described in the muda paper. The

Python audio and music signal processing library

madmom Madmom is an audio signal processing library written in Python with a strong focus on music information retrieval (MIR) tasks. The library is i

pedalboard is a Python library for adding effects to audio.
pedalboard is a Python library for adding effects to audio.

pedalboard is a Python library for adding effects to audio. It supports a number of common audio effects out of the box, and also allows the use of VST3® and Audio Unit plugin formats for third-party effects.

Audio fingerprinting and recognition in Python
Audio fingerprinting and recognition in Python

dejavu Audio fingerprinting and recognition algorithm implemented in Python, see the explanation here: How it works Dejavu can memorize audio by liste

kapre: Keras Audio Preprocessors

Kapre Keras Audio Preprocessors - compute STFT, ISTFT, Melspectrogram, and others on GPU real-time. Tested on Python 3.6 and 3.7 Why Kapre? vs. Pre-co

?️ Open Source Audio Matching and Mastering
?️ Open Source Audio Matching and Mastering

Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

Comments
  • Can't compile on OS X

    Can't compile on OS X

    Compiling using Apple LLVM version 7.0.0 (clang-700.1.76) results in the following error:

    Compiling:  ../src/support/Timer.cpp
    In file included from ../src/support/Timer.cpp:20:
    ../src/support/Timer.h:75:9: error: unknown type name 'clockid_t'; did you mean 'clock_t'?
            clockid_t id_;
            ^~~~~~~~~
            clock_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_clock_t.h:30:33: note: 'clock_t'
          declared here
    typedef __darwin_clock_t        clock_t;
                                    ^
    ../src/support/Timer.cpp:27:19: error: use of undeclared identifier 'CLOCK_PROCESS_CPUTIME_ID'
                id_ = CLOCK_PROCESS_CPUTIME_ID;
                      ^
    ../src/support/Timer.cpp:29:19: error: use of undeclared identifier 'CLOCK_MONOTONIC'
                id_ = CLOCK_MONOTONIC;
                      ^
    ../src/support/Timer.cpp:37:9: error: use of undeclared identifier 'clock_gettime'
            clock_gettime(id_, &time1_);
            ^
    ../src/support/Timer.cpp:44:9: error: use of undeclared identifier 'clock_gettime'
            clock_gettime(id_, &time2_);
            ^
    ../src/support/Timer.cpp:67:9: error: use of undeclared identifier 'clock_getres'
            clock_getres(id_, &res);
            ^
    6 errors generated.
    make: *** [../src/support/Timer.o] Error 1
    

    I am not really familiar with any of the time.h stuff but it looks like this is probably just a Mac OS X issue: http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x/5167506#5167506

    opened by faroit 5
  • Get Segmentation fault (core dumped)

    Get Segmentation fault (core dumped)

    Thanks for the work.

    After installation, I run the following sample code

    import loudness as ln
    
    # All inputs and outputs make use of a SignalBank
    inputBank = ln.SignalBank()
    nSources = 1
    nEars = 1
    nChannels = 1
    nSamples = 1
    fs = 1
    
    # There are 4 dimensions
    inputBank.initialize(nSources, nEars, nChannels, nSamples, fs)
    
    # Set the centre frequency of the first channel
    inputBank.setCentreFreq(0, 1000)
    
    # Set the intensity in normalised units
    level = 40
    inputBank.setSample(0, 0, 0, 0, 10.0 ** (level / 10.0))
    
    # The loudness model
    model = ln.StationaryLoudnessANSIS342007()
    model.initialize(inputBank)
    
    # Now process the input
    model.process(inputBank)
    
    # Get the output of this loudness model
    feature = 'InstantaneousLoudness'
    outputBank = model.getOutput(feature)
    
    print('Loudness in sones %0.2f' % outputBank.getSample(0, 0, 0, 0))
    

    And got the following messages

    /home/sen/env/ml/lib/python3.6/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
      from ._conv import register_converters as _register_converters
    Segmentation fault (core dumped)
    

    It seems the problem occurs at

    outputBank.getSample(0, 0, 0, 0)
    

    Do you have an idea of this problem?

    I have tried python 2.7 and python 3.6. OS: ubuntu 16.04.6 gcc: 5.4.0 g++: 5.4.0

    Thanks

    opened by lightondust 4
  • Can't build python bindings on ubuntu

    Can't build python bindings on ubuntu

    Run the following setup commands:

    cd build
    make
    make install
    cd ../swig
    python setup.py install
    

    I get the following:

    sudo python setup.py install
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
      warnings.warn(msg)
    running install
    running build
    running build_py
    running build_ext
    building 'loudness._core' extension
    swigging core.i to core_wrap.cpp
    swig -python -c++ -o core_wrap.cpp core.i
    ../src/thirdParty/cnpy/cnpy.h:236: Warning 302: Identifier 'create_npy_header' redefined (ignored),
    ../src/thirdParty/cnpy/cnpy.h:40: Warning 302: previous definition of 'create_npy_header'.
    ../src/support/Model.h:170: Error: Syntax error in input(3).
    error: command 'swig' failed with exit status 1
    
    opened by nickjillings 4
  • Can't compile on Ubuntu 14.04

    Can't compile on Ubuntu 14.04

    Hi, thanks a lot for the work ! But I can't manage to install it properly... Do we agree that I only have to go to the swig folder and do ./build.sh in a shell ?

    I try to do so on a Ubuntu 14.04 system with swig3.0 installed with a symbolic link as swig (apt-get install swig wants to install swig2.0) but it's not ending well, core_wrap.cpp seems to not be created.

    Do you have an idea of the problem ? Does it need python 3 ? I'm using python 2.7 thank you, Raph

    opened by raphleiba 2
Owner
Dominic Ward
Dominic Ward
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 359 Feb 15, 2021
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 8, 2023
Audio spatialization over WebRTC and JACK Audio Connection Kit

Audio spatialization over WebRTC Spatify provides a framework for building multichannel installations using WebRTC.

Bruno Gola 34 Jun 29, 2022
praudio provides audio preprocessing framework for Deep Learning audio applications

praudio provides objects and a script for performing complex preprocessing operations on entire audio datasets with one command.

Valerio Velardo 105 Dec 26, 2022
convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format.

convert-to-opus-cli convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format. Installation Must have installed ffmp

null 4 Dec 21, 2022
Python library for audio and music analysis

librosa A python package for music and audio analysis. Documentation See https://librosa.org/doc/ for a complete reference manual and introductory tut

librosa 5.6k Jan 6, 2023
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 5.1k Jan 2, 2023
Python library for handling audio datasets.

AUDIOMATE Audiomate is a library for easy access to audio datasets. It provides the datastructures for accessing/loading different datasets in a gener

Matthias 121 Nov 27, 2022
A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.

Audiomentations A Python library for audio data augmentation. Inspired by albumentations. Useful for deep learning. Runs on CPU. Supports mono audio a

Iver Jordal 1.2k Jan 7, 2023
Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications

A Python library for audio feature extraction, classification, segmentation and applications This doc contains general info. Click here for the comple

Theodoros Giannakopoulos 3.8k Feb 17, 2021