Lesson 52 +10 XP

Spatial Audio & Ambisonics

Spatial Audio & Ambisonics

Unity supports spatialization features to position audio realistically around players in virtual environments.

Spatializers & HRTF

Spatialization simulates 3D audio cues, giving listeners the perception of height, depth, and front-to-back location:

  • In Project Settings -> Audio, assign a Spatializer Plugin (such as Oculus Spatializer or MS HRTF Spatializer).
  • In the AudioSource component, set Spatial Blend to 1.0 (3D) and check Spatialize.
  • Head-Related Transfer Function (HRTF) algorithms filter sound frequencies based on the relative position of the listener's ears.

Ambisonic Audio

Ambisonics is a multi-channel audio format representing a full sphere of sound:

  • Unlike standard stereo or surround sound, Ambisonic tracks rotate dynamically relative to the listener's head rotation.
  • Crucial for 360-degree videos and VR headsets to keep ambient noises mapped to global cardinal directions.
  • Enable by checking Ambisonic in the clip's import settings.

Audio Random Containers

To prevent audio from sounding repetitive:

  • Use Audio Random Containers to group multiple clips (e.g. footstep sound variations).
  • When triggered, they randomize clip selection and apply subtle pitch shifting automatically.

TL;DR

  • Spatializers compute 3D spatial hearing cues using HRTF algorithms.
  • Spatialize must be checked on the AudioSource alongside a 3D Spatial Blend.
  • Ambisonic clips rotate sound fields relative to camera head tracking.
  • Audio Random Containers prevent repetition by randomizing clips and pitch.