Repository navigation
Conversation
pytta.vbap pans sources on 2D and 3D loudspeaker layouts (Pulkki 1997): loudspeaker_pairs and loudspeaker_triplets find the groups (the convex hull of the directions in 3D, without the faces that close a hemisphere), inverse_matrices inverts the matrix of each group and gains gives the gains of a set of source directions, with an optional spread (MDAP). It is a port of the MATLAB library Vector-Base-Amplitude-Panning of Archontis Politis, whose BSD 3-Clause licence is reproduced in the module header. Tests check the tangent law of a stereo pair, that the 3D gains weight the loudspeaker vectors into the source direction, and parity with the MATLAB library on golden data from tests/golden/make_vbap_polarch.m (groups identical, inverses and gains within 4.4e-16). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 31, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
pytta.vbap, vector base amplitude panning (VBAP, Pulkki 1997) for 2D and 3D loudspeaker layouts, with the spread version MDAP (Pulkki 1999). The ITA-Toolbox has VBAP in its spatial audio applications, and this is the first piece of spatial audio in PyTTa.loudspeaker_pairs(azimuths, max_aperture=None): the adjacent pairs of a 2D layout.loudspeaker_triplets(directions, max_aperture=None): the triplets of a 3D layout, the faces of the convex hull of the loudspeaker directions. Faces whose outward normal is at 90 degrees or more from their centroid are left out, which removes the faces that close a hemisphere layout.inverse_matrices(directions, groups): the inverse of the matrix of loudspeaker vectors of each group.gains(directions, groups, inverses, spread=0): the gains of a set of source directions, non-negative and of norm 1. With a spread, the gains of 9 directions across it are summed (MDAP).Directions are in degrees, with 0 degrees in front and 90 degrees to the left, and loudspeaker indices are 0-based.
The module is a port of the MATLAB library Vector-Base-Amplitude-Panning by Archontis Politis and Ville Pulkki (https://github.com/polarch/Vector-Base-Amplitude-Panning). Its BSD 3-Clause licence is reproduced in the module header.
The tests in
tests/test_vbap.pyprint the measured differences:tests/golden/make_vbap_polarch.m(MATLAB R2026b), for a 5.0 layout and the hemisphere layout: the pairs and triplets are identical, and the inverse matrices and the gains, with and without a spread of 20 degrees, agree within 4.4e-16.Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com