HoaMatrixXformer:
Filter:
Classes (extension) | Libraries > Ambisonic Toolkit > Matrix & Kernel > HOA

HoaMatrixXformer
ExtensionExtension

Higher Order Ambisonic (HOA) matrix transformers
Location: NOT INSTALLED!

Description

Generate matrix transformers required by the Ambisonic Toolkit's Higher Order Ambisonic (HOA) transformer, HoaXformMatrix.

Class Methods

.newBeam

Beamform into a Higher Order Ambisonic signal (HOA).

Arguments:

theta

Azimuth, in radians.

phi

Elevation, in radians.

beamShape

Keyword argument for beam shape. See discussion here.

order

Ambisonic order.

.newNull

Nullform into a Higher Order Ambisonic signal (HOA).

Arguments:

theta

Azimuth, in radians.

phi

Elevation, in radians.

beamShape

Keyword argument for beam shape. See discussion here.

order

Ambisonic order.

.newReflect

Mirror a Higher Order Ambisonic signal (HOA).

Arguments:

mirror

Keyword argument for reflection. See discussion below.

order

Ambisonic order.

Discussion:

A variety of reflection transforms are offered:

keywordmirror
\reflectMirror across the origin. Equivalent to: \flip * \flop * \flap.1
\flipMirror in the y-axis.2
\flopMirror in the x-axis.3
\flapMirror in the z-axis.4
\CondonShortleyPhaseCondon-Shortley Phase. Equivalent to: \flip * \flop.
\originSynonym for \reflect.
\xSynonym for \flop.
\ySynonym for \flip.
\zSynonym for \flap.

.newRotateAxis

Rotate a Higher Order Ambisonic signal (HOA) around an axis.

Arguments:

axis

Keyword argument for axis of rotation. See discussion below.

angle

Rotation angle, in radians.

order

Ambisonic order.

Discussion:

Rotation about one of the three cartesian axes are offered via these keywords:

keywordaxis of rotation
\xx-axis
\yy-axis
\zz-axis
\rotateSynonym for \z.
\tiltSynonym for \x.
\tumbleSynonym for \y.
\yawSynonym for \z.
\pitchSynonym for \y.
\rollSynonym for \x.

.newRTT

Compound rotation around the z, x and y axes, applied in sequential order: rotate, tilt, tumble.

NOTE: Extrinsic, "laboratory-fixed" axes.

Arguments:

rotate

Rotation angle around z-axis, in radians.

tilt

Rotation angle around x-axis, in radians.

tumble

Rotation angle around y-axis, in radians.

order

Ambisonic order.

.newYPR

Compound rotation around the z, y' and x" axes: yaw, pitch, roll.

NOTE: Mixed extrinsic (z-axis), intrinsic (y' & x"-axes) rotations. This rotation differs from *newRTT, which is extrinsic.

Arguments:

yaw

Rotation angle around z-axis, in radians.

pitch

Rotation angle around y'-axis, in radians.

roll

Rotation angle around x"-axis, in radians.

order

Ambisonic order.

.newRotate

Compound rotation around the cartesian axes, applied in sequential order.

NOTE: Extrinsic, "laboratory-fixed" axes.

Arguments:

r1

Rotation angle around axis-1, in radians.

r2

Rotation angle around axis-2, in radians.

r3

Rotation angle around axis-2, in radians.

axes

Individual axes are specified via the axial keywords for *newRotateAxis.

Specify order of rotations via concatenation. E.g., rotate, tilt, tumble: \zxy

order

Ambisonic order.

.newSwapAxes

Swap two axes of a Higher Order Ambisonic signal (HOA).

Arguments:

axes

Individual axes are specified via the axial keywords for *newRotateAxis.

Specify swap via concatenation. E.g., swap y-axis with z-azis: \yz

order

Ambisonic order.

.newDominate

Apply dominance along an arbitrary axis.

Arguments:

gain

Dominance gain, in dB.

theta

Azimuth, in radians.

phi

Elevation, in radians.

order

Ambisonic order.

Discussion:

Applies dominance along the axis defined by theta and phi.

Positive values of gain increase the gain at [theta, phi] to +gain dB, while decreasing the gain at [theta.neg, phi.neg] to -gain. This simultaneously results in a distortion of the image towards [theta, phi]. Negative values of gain invert this distortion, distorting towards [theta.neg, phi.neg] . The default, 0, results in no change.

Imaging is illustrated here.

.newZoom

Apply zoom along an arbitrary axis.

Arguments:

angle

Distortion angle, in radians. -pi/2 to pi/2

theta

Azimuth, in radians.

phi

Elevation, in radians.

order

Ambisonic order.

Discussion:

Applies zoom along the axis defined by theta and phi.

Zoom is a normailised dominance variant, specified in terms of a distortion angle. Positive values of angle increase gain at [theta, phi], while reducing at [theta.neg, phi.neg]. Negative values do the inverse. The default, 0, results in no change.

Imaging is illustrated here.

.newFocus

Apply focus along an arbitrary axis.

Arguments:

angle

Distortion angle, in radians. -pi/2 to pi/2

theta

Azimuth, in radians.

phi

Elevation, in radians.

order

Ambisonic order.

Discussion:

Applies focus along the axis defined by theta and phi.

Focus is a normalised dominance variant, specified in terms of a distortion angle. Positive values of angle maintain gain at [theta, phi], while reducing at [theta.neg, phi.neg]. Negative values do the inverse. The default, 0, results in no change.

In contrast with zoom, gain is maintained at 0dB in the direction of distortion.

Imaging is illustrated here.

.newAsymmetry

Apply soundfield asymmetry

Arguments:

angle

Distortion angle, in radians. -pi/2 to pi/2

order

Ambisonic order.

Discussion:

Positive values of angle rotate [-pi/2, 0] towards [0, 0], and at pi/2 collapse the soundfield to a travelling wave. Negative values rotate [pi/2, 0] towards [0, 0]. The default, 0, results in no change.

Imaging is illustrated here.

.newBalance

Apply soundfield balance.

Arguments:

angle

Distortion angle, in radians. -pi/2 to pi/2

order

Ambisonic order.

Discussion:

A synonym for apply zoom along the y-axis.

Balance is a normailised dominance variant, specified in terms of a distortion angle. Positive values of angle increase gain at [pi/2, 0], while reducing at [-pi/2, 0]. Negative values do the inverse. The default, 0, results in no change.

Imaging is illustrated here.

Matrix & File

.newFromMatrix

Transform a Higher Order Ambisonic signal (HOA) via a directly designed spatial filter.

Arguments:

matrix

A Matrix instance.

order

Ambisonic order.

.newFromFile

Create an instance by loading a matrix from a file.

Arguments:

filePathOrName

Can be a path relative to your /extensions/matrices/decoders folder:

Otherwise a full path to your matrix file.

searchExtensions

Search extension paths.

order

Ambisonic order.

Discussion:

See the Guide to ATK Matrix Files for more information.

Inherited class methods

Instance Methods

Information

.info

A convenience method to post the properties of the matrix, including metadata if the matrix was loaded from a .yml file.

.order

Ambisonic order.

.set

Describes both the signal set and the tool set, encompassing the Ambisonic order, as well as channel ordering and normalisation.

Ambisonic Toolkit designation indicating Ambisonic order and encoding format. E.g., \FOA, \HOA3.

For instance, \HOA3:

Ambisonic OrderComponent OrderingComponent Normalisation
3rdAmbisonic Channel Number (ACN)Full 3-D normalisation (N3D)

.type

Ambisonic Toolkit soundfield operation designation. E.g., \encode, \xform, \decode.

.op

Answers 'matrix', i.e. the type of operation used to compute the resulting signals.

.kind

Answers the kind.

.dim

Answers the number of encoder dimensions: 2D or 3D.

.numChannels

Answers the number of input or output channels, depending on -type.

.directions

Answers the directions of input or output channels, depending on -type.

.numInputs

Number of inputs.

.dirInputs

A convenience method providing polymorphism with -directions, depending on -type.

.numOutputs

Number of outputs.

.dirOutputs

A convenience method providing polymorphism with -directions, depending on -type.

Matrix

.matrix

Returns the raw coefficient Matrix.

.thresh2

Bilateral thresholding in place.

Arguments:

thresh

When the input.abs < thresh, the output is forced to 0. Should be a positive value.

.asArray

Returns the matrix as a new Array of rows.

File handling

.fileName

Answers the name of the file used to create the instance, or nil if not created by loading a matrix from a file.

.filePath

Answers the path of the file used to create the instance, or nil if not created by loading a matrix from a file.

.fileParse

If the instance was created by loading a .yml file, this method returns the IdentityDictionary containing the parsed metadata. This can be useful if anything was stored in the metadata that can be subsequently used once reloaded, such as encoding directions, rotations, etc.

NOTE: For simply a quick glance at the metadata, it's recommended to use -info.

.writeToFile

Write the matrix to a file

Arguments:

fileNameOrPath

A String of the file name. The file extension determines the format:

  • .yml allows for additional user-specified metadata (recommended).
  • .txt writes the matrix coefficients only, in rows.
  • .mosl.txt creates basic matrix files compatible with the ATK for Reaper, a set of JSFX plugins for the Reaper DAW.

You may provide a full path if you would like to save the file somewhere other than the default location in the Atk extensions folder. See the Discussion below for more information.

note

A String that is a short description or bit of info about the matrix to store for future reference.

attributeDictionary

A Dictionary containing any information that's useful to store in key:value pairs. Keys that match getters in the AtkMatrix will take precedence over the defaults. See the Discussion for more details.

overwrite

A boolean specifying whether you'd like to force overwriting an existing file of the same name and extension.

Discussion:

The Guide to ATK Matrix Files offers examples and more discussion regarding writing and reading matrices and metadata, including how to generate matrices for use in Reaper.

Analysis

.analyzeAverage

Return an average analysis of transformer amplitude and energies.

Returns:

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

keywordanalysis
\amppressure (virtual loudspeaker sum)
\rmsspherical harmonic energy
\energyvirtual loudspeaker (angular) energy
\meanEtransformer reduced energy
\matchWeighttransformer matching weights (a Dictionary)

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

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

Discussion:

Offers a convenient way to review modifications to the soundfield.

Rotation:

Beamforming:

.analyzeDirections

Return a directional analysis of modifications to the soundfield.

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 an IdentityDictionary, with the following keys:

keywordanalysis
\amppressure (virtual loudspeaker sum)
\rmsspherical harmonic energy
\energyvirtual loudspeaker 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 transformer performance.

Rotation:

Beamforming:

Nullforming:

Inherited instance methods

Examples

TBD

[1] - HOA transform equivalent to FoaXformerMatrix: *newMirrorO.
[2] - HOA transform equivalent to FoaXformerMatrix: *newMirrorY.
[3] - HOA transform equivalent to FoaXformerMatrix: *newMirrorX.
[4] - HOA transform equivalent to FoaXformerMatrix: *newMirrorZ.