HoaMatrixDecoder:
Filter:
atk-sc3/Classes (extension) | Libraries > Ambisonic Toolkit > Matrix & Kernel > HOA

HoaMatrixDecoder
ExtensionExtension

Higher Order Ambisonic (HOA) matrix decoders

Description

Generate matrix decoders required by the Ambisonic Toolkit's Higher Order Ambisonic (HOA) decoder, HoaDecodeMatrix.

Matrix decoding is offered via four different methods:

  1. projection
  2. mode matching
  3. beamforming
  4. format exchange

The first two, projection and mode matching, are suitable for designing decoders for loudspeaker arrays and apply a simple HOA degree truncation where the number of desired outputs is less than the number required for an input Ambisonic order.

The third, beamforming, returns (projection) spatial windows of the input Ambisonic order, without applying degree truncation. This decoding method is suitable for spherical decomposition and beamforming for signal processing.

Format exchange decoding offers interfacing with other Ambisonic formats and systems.

Class Methods

.newProjection

Decode a Higher Order Ambisonic signal (HOA) via the projection method.

Arguments:

directions

An array of directions. Specify in radians.

Rank 1 arrays return pantophonic, while rank 2 arrays return periphonic. E.g.,

beamShape

Keyword argument for beam shape. See discussion below.

match

Keyword argument for gain matching. See discussion below.

order

Ambisonic order.

Discussion:

Also known as Simple Ambisonic Decoding, aka SAD.

NOTE: In order to return a valid reconstruction decoder, directions should be evenly distributed.

.newModeMatch

Decode a Higher Order Ambisonic signal (HOA) via the mode matching method.

Arguments:

directions

An array of directions. Specify in radians.

Rank 1 arrays return pantophonic, while rank 2 arrays return periphonic. E.g.,

beamShape

Keyword argument for beam shape. See discussion below.

match

Keyword argument for gain matching. See discussion below.

order

Ambisonic order.

Discussion:

Also known as Pseudoinverse Decoding, aka Pinv.

NOTE: Comprehensive modal discarding is not applied. More evely distributed directions will return a more stable decoder.

.newDiametric

Decode a Higher Order Ambisonic signal (HOA) via the mode matching method, given diametrically matched loudspeaker pairs. Gerzon's classic diametric decoder.1

Arguments:

directions

An array of directions for half of the loudspeaker feeds for the desired decoder. Specify in radians.

Rank 1 arrays return pantophonic, while rank 2 arrays return periphonic. E.g.,

beamShape

Keyword argument for beam shape. See discussion below.

match

Keyword argument for gain matching. See discussion below.

order

Ambisonic order.

Discussion:

Also known as Diametric Decoding.

directions specifies only half of the loudspeakers for the resulting array, the remaining loudspeakers are diametrically opposite (through the origin). -directions may be used to query resulting loudspeaker directions.

.newPanto

Decode a Higher Order Ambisonic signal (HOA) via the projection method to a Pantophonic (2D) regular polygon array.

Arguments:

numChans

number of outputs

orientation

\vertex or \side

beamShape

Keyword argument for beam shape. See discussion below.

match

Keyword argument for gain matching. See discussion below.

order

Ambisonic order.

Discussion:

The outputs are in anti-clockwise order. The position of the first speaker is either centre or left of centre. -directions may be used to query resulting loudspeaker directions.

Used in conjunction with HoaDecodeMatrix the resulting decoder is equivalent to DecodeB2 (SuperCollider's inbuilt decoder), albeit with the addition of variable beam shape and gain matching. DecodeB2 is a controlled opposites decoder.

.newSphericalDesign

Beamform into a Higher Order Ambisonic signal (HOA), returning multiple beams evenly distributed in a SphericalDesign.

Arguments:

design

SphericalDesign instance

beamShape

Keyword argument for beam shape. See discussion below.

order

Ambisonic order.

Discussion:

A-format decoding, aka spherical decomposition, is offered by *newSphericalDesign.

Gain is matched to maximum beam amplitude.

NOTE: Matching spherical (re-)composition is provided by HoaMatrixEncoder: *newSphericalDesign.

.newDirection

Beamform into a Higher Order Ambisonic signal (HOA), returning a single beam.

Arguments:

theta

Azimuth, in radians.

phi

Elevation, in radians.

beamShape

Keyword argument for beam shape. See discussion below.

order

Ambisonic order.

Discussion:

Returns a single beam, and can be used to "listen in" to the soundfield at the specified azimuth and elevation. Gain is matched to the beam. See discussion below

.newDirections

Beamform into a Higher Order Ambisonic signal (HOA), returning multiple beams.

Arguments:

directions

An array of directions. Specify in radians.

Rank 1 arrays return pantophonic, while rank 2 arrays return periphonic. E.g.,

beamShape

Keyword argument for beam shape. See discussion below.

match

Keyword argument for gain matching. See discussion below.

order

Ambisonic order.

Discussion:

Returns a collection of beams, and can be used to "listen in" to the soundfield at the specified azimuths and elevations.

WARNING: As a projection beamformer, does not return a valid reconstruction decoder for arbitrary loudspeaker directions. Similarly, Ambisonic order is not truncated given an insufficient number of loudspeakers or distribution of directions.

.newFormat

An Ambisonic format exchange decoder. Decodes from ACN-N3D to a variety of formats.

Arguments:

format

An array of kewords designating component ordering and normalisation.

E.g., target output format ACN-SN3D is expressed [ \acn, \sn3d ]. See discussion below.

order

Ambisonic order.

Discussion:

A variety of component ordering and normalisation schemes are supported. These are:

ordering

\acnAmbisonic Channel Number (ACN)
\sidSingle Index Designation (SID)
\fumaFurse-Malham (FuMa)

normalisation

\n3dOrthonormal basis for 3D decomposition (N3D)
\sn3dSemi-normalised basis for 3D decomposition (SN3D)
\n2dOrthonormal basis for 2D decomposition (N2D)
\sn2dSemi-normalised basis for 2D decomposition (SN2D)
\maxNMaximum normalisation (maxN)
\MaxNGerzon / Furse-Malham (MaxN)
\fumaSynonym for MaxN (FuMa)

Additionally, a number of common formats are available as a single keyword:

\atkAmbisonic Toolkit (ATK)
\ambixAmbisonics Exchangeable (AmbiX)
\fumaFurse-Malham (FuMa)

Matrix & File

Beam shape

Three standard beam shapes are offered:

keywordbeam shapelocalisation vectorvirtual microphone
\basicstrict soundfieldmaximum velocity rVHyper-cardioid
\energyenergy optimisedmaximum energy rESuper-cardioid
\controlledcontrolled oppositesminimum diametric energyCardioid
NOTE: For large-scale concert presentation, the authors advise choosing the energy optimised beam shape.

Gain match

Decoder gains can be normalised, aka matched, via various criteria:

keywordmatching criteriavalid decoding methods
\beammaximum beam amplitudebeamforming only
\amppressure (loudspeaker sum)all methods
\rmsspherical harmonic energyprojection & mode matching only
\energyloudspeaker energyprojection & mode matching only

Normalising gain to the beam amplitude is appropriate for a virtual microphone or spherical decomposition context. In this case, maximum amplitude of each returned beam is normalised to 0dB.

The other three criteria, pressure, total spherical harmonic energy, and total loudspeaker energy, are preferred for building decoders for loudspeaker audition.

Instance Methods

Information

Matrix

File handling

Analysis

.analyzeAverage

Return an average analysis of decoder amplitude and energies.

Returns:

Analysis is returned in an IdentityDictionary, with the following keys:

keywordanalysis
\amppressure (loudspeaker sum)
\rmsspherical harmonic energy
\energyloudspeaker (angular) energy
\meanEdecoder reduced energy
\matchWeightdecoder matching weights (a Dictionary)

The required weights for gain matching are returned in the \matchWeight Dictionary:

keywordanalysis
\ampmatch weight for pressure (loudspeaker sum)
\rmsmatch weight for spherical harmonic energy
\energymatch weight for loudspeaker energy

Discussion:

Offers a convenient way to check whether designed decoders meet the theoretical performance predicted by HoaOrder.

A regular array, evenly distributed loudspeakers:

Unevenly distributed loudspeakers:

.analyzeDirections

Return a directional analysis of decoder performance.

Arguments:

directions

A single azimuth value, or an array of test directions. Specify in radians.

Rank 1 arrays return pantophonic, while rank 2 arrays return periphonic. E.g.,

Returns:

Analysis is returned in a an IdentityDictionary, with the following keys:

keywordanalysis
\amppressure (loudspeaker sum)
\rmsspherical harmonic energy
\energyloudspeaker energy
\spreadEenergy spread (a Dictionary)
\rVvelocity localisation vector, rV (a Dictionary)
\rEenergy localisation vector, rE (a Dictionary)

Two measures of energy spread are offered in the \spreadE Dictionary:

keywordanalysis
\cosroll-off to ~-3dB, in radians
\hvcroll-off to ~-6dB, in radians

Information regarding rV, the velocity localisation vector, is returned in the \rV Dictionary:

keywordanalysis
\magnitudesvector magnitudes
\directionsvector directions, in radians
\warpangle distortion from test directions, in radians
\rEwarpangle distortion from rE, in radians
\xyzrV, in cartesian coordinates

Similarly, information regarding rE, the energy localisation vector, is returned in the \rE Dictionary:

keywordanalysis
\magnitudesvector magnitudes
\directionsvector directions, in radians
\warpangle distortion from test directions, in radians
\rVwarpangle distortion from rV, in radians
\xyzrE, in cartesian coordinates

Offers detailed analysis of decoder performance.

A regular array, evenly distributed loudspeakers:

Unevenly distributed loudspeakers:

Examples

Designs

Analysis & plotting

A few functions useful for visualizing decoder performance.

Equatorial rV & rE

A function to plot the velocity and energy localisation vectors in the equatorial plane:

Equatorial rV & rE error

A function to plot velocity and energy localisation vector error in the equatorial plane:

NOTE: Center of table is front center of the array.

Equatorial energy spread

A function to plot energy spread in the equatorial plane:

NOTE: Center of table is front center of the array.

Equatorial amplitude and energy

A function to plot amplitude and energy in the equatorial plane:

NOTE: Center of table is front center of the array.

[1] - See: M. A. Gerzon, "Practical Periphony: The Reproduction of Full-Sphere Sound," in Proceedings of the 65th Audio Engineering Engineering Society Convention, London, 1980, p. 10.