main content

ambisonic plugin generation -凯发k8网页登录

this examples shows how to create ambisonic plugins using matlab® higher order ambisonic (hoa) demo functions. ambisonics is a spatial audio technique which represents a three-dimensional sound field using spherical harmonics. this example contains an encoder plugin, a function to generate custom encoder plugins, a decoder plugin, and a function to generate custom decoder plugins. the customization of plugin generation enables a user to specify various ambisonic orders and various device lists for a given ambisonic configuration.

background

ambisonic encoding is the process of decomposing a sound field into spherical harmonics. the encoding matrix is the amount of spherical harmonics present at a specific device position. in mode-matching decoding, the decoding matrix is the pseudo-inverse of the encoding matrix. ambisonic decoding is the process of reconstructing spherical harmonics into a sound field.

this example involves higher order ambisonics, which include traditional first-order ambisonics. in ambisonics, there is a relationship between the number of ambisonic channels and the ambisonic order:

       ambisonic_channels = (ambisonic_order   1)^2 

for example: first-order ambisonics requires four audio channels while fourth-order ambisonics requires 25 audio channels.

supported conventions

  • acn channel sequencing

  • sn3d normalization

  • azimuth from 0 to 360 degrees

  • elevation from -90 to 90 degrees

the ambisonic design examples support up to seventh-order ambisonics with pseudo-inverse decoding.

ambisonic devices: elements and speakers

ambisonic devices are divided into two groups: elements and speakers. each device has an audio signal and metadata describing its position and operation. elements correspond to multi-element microphone arrays, and speakers correspond to loudspeaker arrays for ambisonic playback.

the ambisonic encoder applies the ambisonic encoding matrix to raw audio from microphone elements. the position (azimuth, elevation) and devicetype of the microphone elements along with desired ambisonic order are needed to create the ambisonic encoding matrix.

the ambisonic decoder applies the ambisonic decoding matrix to ambisonic audio for playback on speakers. the position (azimuth, elevation) and devicetype of the speakers along with desired ambisonic order are needed to create the ambisonic decoding matrix.

sound field representation

in order to capture, represent, or reproduce a sound field with ambisonics, the number of devices (elements or speakers) must be greater than or equal to the number of ambisonic channels.

for the encoding example, audio captured with a 32-channel spherical array microphone may be encoded up to fourth-order ambisonics (25 channels). for the decoding example, a loudspeaker array containing 64 speakers is configured for ambisonic playback up to seventh-order. if the playback content is fourth order ambisonics, then even though the array is set up for seventh- order, only fourth-order ambisonics is realized through the system.

       number_devices >= number_ambisonic_channels

for an encoder, if the number of devices (elements) is less than the number of ambisonic channels, then audio from the device (elements) positions may be represented in ambisonics, but a sound field is not represented. one or more audio channels may be encoded into ambisonics in an effort to position sources in an ambisonic field. each encoder represents the intensity of the sound field to be encoded at a specified device (element) location.

for a decoder, if the number of devices (speakers) is less than the number of ambisonic channels, the devices (speakers) do not fully reproduce a sound field at the specified ambisonic order. a sound field may be reproduced at a lower ambisonic order. for example, third-order ambisonics played on a speaker array with 10 speakers can be realized as a second-order (9 channel) system with an additional speaker for playback. each decoder represents an intensity of the ambisonic field at the specified device (speaker) position.

pseudoinverse decoding method

there are many decoding options. this example uses pseudoinverse decoding, also known as mode matching. this decoding method favors regular-shaped device layouts. other decoding methods may favor irregular-shaped device layouts.

device type

the devicetype for encoders turns the device (element) encoding on or off for a particular element. the devicetype for decoders turns the device (speaker) decoding on or off for a particular speaker. if the devicetype vector is omitted, then the devicetypes are set to 1 (on). the intention behind devicetype is to provide flexibility of padding encoder inputs or decoder outputs with off channels to fit an ambisonic encoder or decoder plugin into an environment with fixed channel counts such as an 8-, 16- or 32-channel audio bus.

for example: a second-order ambisonic encoder with 14 elements has 14 inputs and 9 outputs. if you add two more devices (elements) with devicetype 0 (off) to the encoder, then the encoder has 16 inputs and 9 outputs. a fourth-order ambisonic decoder with 29 devices (speakers) has 25 inputs and 29 outputs. if you add three more devices (speakers) with devicetype 0 (off) to the decoder, then the channel count becomes 25 inputs and 32 outputs.

when the devicetype is set to 0 (off), the azimuth and elevation for that channel are ignored; however, a value is still needed. it is recommended to set the azimuth and elevation to 0 degrees when the device types are set to 0 (off).

ambisonic encoder plugin

audiopluginexample.ambiencoderplugin is built around the audioexample.ambisonics.ambiencodemtrx and audioexample.ambisonics.ambiencode functions. the number of devices (elements to be encoded) is the number of input channels of the encoder plugin. the ambisonic order determines the number of output channels of the encoder plugin.

audioexample.ambisonics.ambiencodemtrx generates the ambisonic encoder matrix from a given ambisonic order and a given device list. audioexample.ambisonics.ambiencode applies the ambisonic encoder matrix to raw audio resulting in ambisonic encoded audio. the formatting of the ambisonic audio may be specified with the audioexample.ambisonics.ambiencode function. the number of raw audio channels must equal the number of devices in the ambisonic encoder matrix.

the encoder plugin inherits directly from the audioplugin base class. the plugin constructor calls audioexample.ambisonics.ambiencodemtrx to build the initial encoder matrix. the process function calls audioexample.ambisonics.ambiencode to apply the encoder matrix to the audio input. the output of the plugin is ambisonic encoded audio. the encoder matrix is recalculated only when a plugin property is modified which minimizes computations inside the process loop.

the plugin interface populates azimuth and elevation but not device type. the idea behind device type is to add off-channels to an encoder matrix to fit the matrix into a 8x-channel frame. for example: second-order has 9 channels, create a 16 channel encoder matrix, with the first 9 channels having device type of 1 (on) and the remaining 7 channels having device type of 0 (off).

audiotestbench(audiopluginexample.ambiencoderplugin)

audiotestbench('-close')

| |

generate custom ambisonic encoder plugin

generating ambisonic plugins can be an involved process. the function streamlines the process of generating ambisonic encoder plugins. this function supports up to seventh-order ambisonics. supported formats are 'acn-sn3d', 'acn-n3d', 'acn-fuma', 'acn-maxn', 'fuma-sn3d', 'fuma-n3d', 'fuma-fuma', 'fuma-maxn'. the function requires the following inputs:

  1. name of the audioplugin class

  2. device list of encoder positions

  3. ambisonic order

  4. ambisonic format

% provide a name for the audioplugin class
name = 'myencoderplugin';
% include a device list of element positions
device = [45 135 225 315 45 135 225 315; -45 -45 -45 -45 45 45 45 45];
% specify the ambisonic order
order = 3;
% specify the ambisonic format
format = 'acn-sn3d';

run the function.

audioexample.ambisonics.ambigenerateencoderplugin(name, device, order, format)

once designed, the audio plugin can be validated, generated, and deployed to a third-party digital audio workstation (daw).

ambisonic decoder plugin

audiopluginexample.ambidecoderplugin is built around the audioexample.ambisonics.ambidecodemtrx and audioexample.ambisonics.ambidecode functions. the ambisonic order determines the number of input channels of the decoder plugin. the number of devices (speakers locations) is the number of output channels of the decoder plugin.

audioexample.ambisonics.ambidecodemtrx generates the ambisonic decoder matrix from a given ambisonic order and a given device list. audioexample.ambisonics.ambidecode applies the ambisonic decoder matrix to ambisonic audio resulting in decoded audio. the formatting of the ambisonic audio may be specified with the audioexample.ambisonics.ambidecode function. audioexample.ambisonics.ambidecode determines the ambisonic order from the minimum of the ambisonic order of the input audio and the ambisonic order of the decoder matrix.

the decoder plugin inherits directly from the audioplugin base class. the plugin constructor calls audioexample.ambisonics.ambidecodemtrx to build the initial decoder matrix. the process function calls audioexample.ambisonics.ambidecode to apply the decoder matrix to the audio input. the output of the plugin is decoded audio. the decoder matrix is recalculated only when a plugin property is modified which minimizes computations inside the process loop.

the plugin interface populates azimuth and elevation but not device type. the idea behind device type is to add off-channels to an encoder matrix to fit the matrix into a 8x-channel frame. for example: second-order has 9 channels, create a 16 channel encoder matrix, with the first 9 channels having device type of 1 (on) and the remaining 7 channels having device type of 0 (off).

audiotestbench(audiopluginexample.ambidecoderplugin)

audiotestbench('-close')

| |

generate custom ambisonic decoder plugin

generating ambisonic plugins can be an involved process. the function streamlines the process of generating ambisonic decoder plugins. this function supports up to seventh-order ambisonics. supported formats are 'acn-sn3d', 'acn-n3d', 'acn-fuma', 'acn-maxn', 'fuma-sn3d', 'fuma-n3d', 'fuma-fuma', 'fuma-maxn'. the function requires the following inputs:

  1. name of the audioplugin class

  2. device list of decoder positions

  3. ambisonic order

  4. ambisonic format

% provide a name for the audioplugin class
name = 'mydecoderplugin';
% include a device list of speaker positions
device = [45 135 225 315 45 135 225 315; -45 -45 -45 -45 45 45 45 45];
% specify the ambisonic order
order = 3;
% specify the ambisonic format
format = 'acn-sn3d';

run the function.

audioexample.ambisonics.ambigeneratedecoderplugin(name,device,order,format)

once designed, the audio plugin can be validated, generated, and deployed to a third-party digital audio workstation (daw).

see also

ambisonic binaural decoding

related topics

references

[1] kronlachner, m. (2014). spatial transformations for the alteration of ambisonic recordings (master's thesis).

[2] https://en.wikipedia.org/wiki/ambisonics

[3] https://en.wikipedia.org/wiki/ambisonic_data_exchange_formats

网站地图