https://github.com/deeuu/loudness
Audio library for modelling loudness
https://github.com/deeuu/loudness
Last synced: 9 months ago
JSON representation
Audio library for modelling loudness
- Host: GitHub
- URL: https://github.com/deeuu/loudness
- Owner: deeuu
- License: gpl-3.0
- Created: 2014-10-12T20:57:43.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-08T08:33:32.000Z (over 6 years ago)
- Last Synced: 2024-08-01T02:27:16.625Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 845 KB
- Stars: 35
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python-scientific-audio - Loudness - Perceived loudness, includes Zwicker, Moore/Glasberg model. (Audio Related Packages)
README
# 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](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)
~~~