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.
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.
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.
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:
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.
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:
UnityAudioEffectDefinitionFlags_IsAmbisonicDecoder
.UnityAudioAmbisonicData
.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;
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.