Skip to main content

Bayesian Listener

Tired to run experiments with real listeners? This model simulates their behavior in a sound localisation task by offering a Bayesian model reproducing human directional sound localization performances.

Moreover, this package offers an explicit likelihood function for parameter estimation (how noisy is this participant in comparison to another one, or how do parameters change over listening conditions?) based on principled maximum likelihood estimation, and statistical model comparison (is this spatial feature better than this other one?).

The model combines an observer's prior expectations about source locations with spectral cues (via individual HRTF) and interaural timing/level differences, producing likelihood surfaces that characterize listener behavior in 3D space.

Key Features:

  • Fit localization behavior from behavioral data
  • Recover and validate model parameters with maximum likelihood estimation
  • Compare HRTF interpolation methods quantitatively
  • Generate synthetic responses for validation and analysis
  • Accelerated computation via just-in-time compilation with numba

Installation

pip install bayesian_listener

Requires Python 3.10 or higher.

Quick Start

from bayesian_listener import BayesianListener

hrtf_data = 'hrtf.sofa'

listener = BayesianListener(hrtf=hrtf_data)
listener.compute_template()
estimations = listener.localise()

print(estimations.spherical_elevation[..., 0:2])

See Getting Started for more detailed examples.

Documentation

  • Getting Started — Installation and first example
  • Guides — Task-oriented walkthroughs (fitting, simulation, HRTF comparison)
  • API Reference — Complete class and function documentation
  • Background — Statistical framework and equations

References

Barumerli, R., Majdak, P., Geronazzo, M., Meijer, D., Avanzini, F., & Baumgartner, R. (2023). A Bayesian model for human directional localization of broadband static sound sources. Acta Acustica, 7, 12. Paper

Barumerli, R., Brinkmann, F., Zanoni, E., Hoyer, A., Picinali, L., & Geronazzo, M. (2026). Statistical validation and full-sphere extension of a Bayesian model for human static sound localisation. Acta Acustica, 10, 89. Paper

License

EUPL 1.2 (European Union Public Licence)

Authors

  • Roberto Barumerli — Main model implementation and validation
  • Fabian Brinkmann — Spherical harmonics interpolation and interface design
  • Anton Hoyer — Continuous integration, PyFAR and SOFAr integration
  • Emanuele Zanoni — Implementation validation

Acknowledgements

The original model was implemented in MATLAB within the Auditory Modeling Toolbox (AMT). This Python version incorporates code components from AMT (e.g., gammatone filtering). We are grateful to the AMT authors for sharing their work.

The spherical t-design grids bundled with this package were originally published by Manuel Gräf and redistributed by spaudiopy.

The VBAP interpolation algorithm is adapted from spaudiopy, based on Pulkki, V. (1997).

Metadata

Release files for bayesian-listener 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bayesian-listener 0.3.0
File Size Uploaded
bayesian_listener-0.3.0.tar.gz 665.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bayesian-listener 0.3.0
File Interpreter ABI Platform
bayesian_listener-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / bayesian_listener-0.3.0.tar.gz

Download URL bayesian_listener-0.3.0.tar.gz
Size 665.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a3ccb62251bd40955c36f4622d7181e0a6a7e8b40c22f3fd601ca46356f077de
BLAKE2b-256 checksum
How to use checksums
7b19d70e33390860f5c2b65136bdecaa2f0e63b173d8e69628ae53c5a6a9c53a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / bayesian_listener-0.3.0-py3-none-any.whl

Download URL bayesian_listener-0.3.0-py3-none-any.whl
Size 665.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
815c8a723a1f9c16ac321e9a02202ce316cad5fe9e7a7bfff58a6c5d96f9d751
BLAKE2b-256 checksum
How to use checksums
91b660048d0e630f374f8a6455139df13ce994df59e1607064b14ebf183fa2b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page