Version: 2021.1
Audio Profiler
Audio Clip

Ambisonic Audio

Ambisonics are a type of audio that provide a representation of sound that can completely surround a listener. They can provide an audio skyboxA special type of Material used to represent skies. Usually six-sided. More info
See in Glossary
for distant ambient sounds, and are particularly useful for 360-degree videos and applications.

Ambisonics are stored in a multi-channel format. Instead of mapping each channel to a specific speaker, ambisonics represent the soundfield in a more general way. You can rotate the soundfield based on the listener’s orientation (such as the user’s head rotation in VR). You can also decode the soundfield into a format that matches the speaker setup.

Selecting an ambisonic audio decoder

To select an ambisonic audio decoder in your project, open your project’s Audio settings (menu: Edit > Project Settings > Audio). Select an Ambisonic Decoder Plugin from the list of available decoders in the project. There are no built-in decoders included with Unity, but some VR hardware manufacturers provide them in their audio SDKs for Unity. Check your target platform manufacturer’s documentation to learn if this is available for your project.

Ambisonic options in the Audio settings
Ambisonic options in the Audio settings

Importing an ambisonic audio clip

To import an ambisonic audio clipA container for audio data in Unity. Unity supports mono, stereo and multichannel audio assets (up to eight channels). Unity can import .aif, .wav, .mp3, and .ogg audio file format, and .xm, .mod, .it, and .s3m tracker module formats. More info
See in Glossary
, import a multi-channel B-format WAV file with ACN component ordering, and SN3D normalization. In the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary
window for the audio clip, enable Ambisonic.

The Ambisonic option in the audio clip inspector
The Ambisonic option in the audio clip inspector

Playing the ambisonic audio clip through an Audio Source

To play an ambisonic audio clip through an Audio SourceA component which plays back an Audio Clip in the scene to an audio listener or through an audio mixer. More info
See in Glossary
:

  • Assign the WAV file as an Audio Clip on an Audio Source.
  • Disable the Spatialize option. When you play an ambisonic audio clip, it is automatically decoded through the project’s selected ambisonic audio decoder. The decoder converts the clip from ambisonic format to the project’s selected speaker format. It also already handles spatialization as a part of this decoding operation, based on the orientation of the audio source and audio listenerA component that acts like a microphone, receiving sound from Audio Sources in the scene and outputting to the computer speakers. More info
    See in Glossary
    .

When Unity plays an ambisonic audio clip, it decompresses the file, if necessary, then decodes it to convert it to the project’s selected speaker mode. It then applies the Audio Source’s effects.

Note: Reverb zones are disabled for ambisonic audio clips.

Audio plugin interface changes

For information on how to author a plugin, see the Unity User Manual pages on the Native Audio Plugin SDK and Audio Spatializer SDK. You should also download the Audio plugin SDK.

There are two changes to AudioPluginInterface.h for ambisonic audio decoders:

  • A new effect definition flag, UnityAudioEffectDefinitionFlags_IsAmbisonicDecoder.
  • A new data struct, UnityAudioAmbisonicData.

UnityAudioEffectDefinitionFlags_IsAmbisonicDecoder

During the plugin scanning phase, this flag notifies Unity that this effect is an ambisonic decoder. Unity then allows the decoder to display as an ambisonic decoder option in your Project settingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
See in Glossary
for Audio.

definition.flags |= UnityAudioEffectDefinitionFlags_IsAmbisonicDecoder;

UnityAudioAmbisonicData struct

The UnityAudioAmbisonicData struct is similar to the UnityAudioSpatializerData struct that Unity passes into spatializers, but with the addition of an ambisonicOutChannels integer. For more information on the UnityAudioSpatializerData struct, see the Audio Spatializer SDK documentation on spatializer effect meta data.

For the UnityAudioAmbisonicData struct, the ambisonicOutChannels should be set to the DefaultSpeakerMode’s channel count. Ambisonic decoders run early in the audio pipeline in Unity, and ambisonicOutChannels tells the plugin how many of the output channels Unity needs to use.

If you play back a first order ambisonic audio clip which contains 4 channels, and your speaker mode is stereo (which has only 2 channels), an ambisonic decoder’s process callback passes in 4 for the in and out channel count. The ambisonicOutChannels field is set to 2. The plugin should output its spatialized data to the first 2 channels and zero out the other 2 channels.

The Unity ambisonic sources framework can support first order ambisonics. The plugin interface includes the information to support binaural stereo and quadA primitive object that resembles a plane but its edges are only one unit long, it uses only 4 vertices, and the surface is oriented in the XY plane of the local coordinate space. More info
See in Glossary
output, but the plugin itself determines which outputs are supported. Initially, ambisonic decoder plugins support first order ambisonic sources and binaural stereo output. There is no support for second order ambisonics.

There is nothing in the framework that is specific to any of the different ambisonic formats available. If the clip’s format matches the ambisonic decoder plugin’s expected format, then ambisonic audio should work without issue. Unity’s preferred ambisonic format is B-format, with ACN component ordering, and SN3D normalization.


  • 2017–08–10 Page published
  • New feature in Unity 2017.1 NewIn20171
Audio Profiler
Audio Clip