Set up and use ambisonic audio in your Unity projects.
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.
To select an ambisonic audio decoder in your 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.
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:
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();
}
}
}
}
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: