Version: Unity 6.6 Alpha (6000.6)
Language : English
Introduction to ambisonic audio
Introduction to ambisonic audio decoders

Use ambisonic audio in your project

Set up and use ambisonic audio in your Unity projects.

Select an ambisonic audio decoder

To use ambisonic audio in your projects, you need to use an ambisonic audio decoder and assign it in your project’s Audio settings. For instructions on how to create an ambisonic audio decoder, refer to Develop an ambisonic audio decoder.

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

To select an ambisonic audio decoder in your project:

  1. Go to Edit > Project Settings > Audio.
  2. Select an Ambisonic Decoder Plugin from the list of available decoders in the project.

Warning: Some ambisonic decoder plug-ins don’t support all speaker modes available in Unity. If you use an unsupported speaker mode with such a plug-in, it can cause errors or crashes. Verify your decoder plug-in’s documentation for supported speaker modes.

To create a custom ambisonic audio decoder, refer to Develop an ambisonic audio decoder.

Import 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
:

  1. Import a multi-channel B-format WAV file with ACN component ordering, and SN3D normalization.
  2. In the Project window in the Unity Editor, select the imported audio clip. 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 that audio clip shows.
  3. In the Inspector window, enable Ambisonic.
The Ambisonic option in the audio clip inspector
The Ambisonic option in the audio clip inspector

Load ambisonic audio at runtime

To load an ambisonic audio clip at runtime, use UnityWebRequestMultimedia.GetAudioClip with the ambisonic parameter. This is especially useful for loading audio files from the StreamingAssets folder.

The following script is an example of how to load an ambisonic audio clip:

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class LoadAmbisonicClip : MonoBehaviour
{
    public AudioSource audioSource;

    IEnumerator Start()
    {
        string path = System.IO.Path.Combine(Application.streamingAssetsPath, "MyAmbisonicClip.wav");
        string url = path.Contains("://") ? path : "file://" + path;
        using (UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.WAV, ambisonic: true))
        {
            yield return request.SendWebRequest();

            if (request.result == UnityWebRequest.Result.Success)
            {
                AudioClip clip = DownloadHandlerAudioClip.GetContent(request);
                audioSource.clip = clip;
                audioSource.Play();
            }
        }
    }
}

Play 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
:

  1. Assign the WAV file as an Audio Clip on an Audio Source.
  2. Disable the Spatialize option.

Additional resources

Introduction to ambisonic audio
Introduction to ambisonic audio decoders