LoudnessModel
Python translation of the Cambridge MATLAB code for the TVL2018 loudness model: Moore et al. (2016) with the revised time constants of Moore et al. (2018). Computes instantaneous, short-term and long-term loudness, in a NumPy version and a JAX version.
| Repository | https://github.com/MalcolmSlaney/LoudnessModel |
|---|---|
| Language | Python |
| Kind | Research code Code published with a study, a thesis or a student project, to run or adapt; not packaged as a library. |
| Group | developing Public for more than a year, but without a publication or documented use by others: research, teaching or personal code. |
| Licence | BSD-2-Clause The README also says "The source code is provided free for any research purposes"; the readme of the Cambridge MATLAB code tv2018.m (see iso532-3) uses similar wording and asks commercial users to contact Brian C. J. Moore. |
| Latest release | no release |
| Last commit | 2025-03-20 inactive since 2025-03 |
| GitHub stars | 19 |
| Maintainers | Jeremy JX Hsiao, Malcolm Slaney |
| AI assistance | not stated |
| How to cite | The project does not say how to cite it. Cite the repository with the version or commit you used. |
| Entry checked | 6 October 2026 |
What it implements
| Metric | Edition | Functions | Validation (as stated) | Notes |
|---|---|---|---|---|
| Time-varying loudness (Moore–Glasberg–Schlittenlacher) | Moore et al. (2018) instantaneous, short-term and long-term loudness; binaural | tvl2018.compute_loudness, tvl2018_jax.compute_loudness | own tests only | developing |
How it was validated
As reported by the project; LISQM has not run the code. Two implementations that agree can still share the same error. Kinds of evidence.
- Time-varying loudness (Moore–Glasberg–Schlittenlacher) · Moore et al. (2018)
own tests only
Ported or adapted from iso532-3 (tv2018.m).
- Tests run in GitHub Actions compare overall loudness, the first five short-term and long-term values and selected intermediate stages for one input (1 kHz tone, 100 ms, 32 kHz) with hard-coded expected values.
- The README calls this "a known accurate output", but neither it nor the tests say where the values come from.
Notes
- The README credits Brian C. J. Moore, Brian R. Glasberg and Josef Schlittenlacher for the MATLAB model and links the original MATLAB code (the first download on https://www.psychol.cam.ac.uk/hearing#programs). That page now needs a University of Cambridge login; an archived copy from November 2025 still links the code, an earlier version of the code in iso532-3.
- The Python function names largely mirror the MATLAB files of tv2018 (see iso532-3), e.g.
agc_next_frameforAGCNextFrame.m. ISO 532-3 is not mentioned in the repository. - Outer- and middle-ear transfer functions for free-field, diffuse-field and eardrum presentation are included for 32 kHz.
- There is no packaging metadata (no pyproject.toml or setup.py) and no PyPI package; the README installs from a clone with requirements.txt. A Colab notebook with demos is linked.
Before you rely on it
- The README says the JAX version "does not compile as there are several portions of the implementation that are not pure".