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 (under review). Pre-print

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.2.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.2.0
File Size Uploaded
bayesian_listener-0.2.0.tar.gz 325.8 kB Details

Built distribution (wheel)

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

Total release size: 653.7 kB

Release files / bayesian_listener-0.2.0.tar.gz

Download URL bayesian_listener-0.2.0.tar.gz
Size 325.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1eb55a34e40754f96808694820c8905c48b2975fa1308b9447bab1e2a5578cd4
BLAKE2b-256 checksum
How to use checksums
689c03f74f6a587f32b4e3d61c86e0aa540951fceee7b81d16d5e4bbdfa12520
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.2.0-py3-none-any.whl

Download URL bayesian_listener-0.2.0-py3-none-any.whl
Size 327.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5729343a0b2a2c251342d88f84fd7b0ecf10c4d3d8be376c660716a823352311
BLAKE2b-256 checksum
How to use checksums
850847c8882005263a8d2504f24d67e7ee76d6c5aa60595632c73e46882aa537
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

0.3.0

2 release files

This release

0.2.0 This release

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