Spatial sound in Unity

This page links to resources for spatial sound in Unity.

Spatializer options

Spatializer options for mixed reality applications include:

  • Unity provides the MS HRTF Spatializer as part of the Windows Mixed Reality optional package.
    • Runs on CPU in a higher-cost 'single-source' architecture.
    • Provided for backwards compatibility with original HoloLens applications.
  • The Microsoft Spatializer is available from the Microsoft spatializer GitHub repository.
    • Uses a lower-cost 'multi-source' architecture.
    • Offloaded to a hardware accelerator on the HoloLens 2.

For new applications, we recommend the Microsoft Spatializer.

Enable spatialization

Use the Mixed Reality Feature Tool to download the latest version of the Microsoft Spatializer feature. Then follow the step-by-step instructions for enabling the plugin in your Unity project.

Once the spatialization and mixer plugins are in place, to enable spatial audio for a sound source:

  • Attach an Audio Source to an object in the hierarchy
  • Check the Enable spatialization checkbox
  • Move the Spatial Blend slider to '1'

Note

If you get an error in Unity about not being able to load Microsoft Spatializer plugin because one of its dependencies is missing, check that you have the latest version of the Microsoft Visual C++ Redistributable installed on your PC.

For more information, see:

Distance-based attenuation

Unity's default distance-based decay has a minimum distance of 1 meter and a maximum distance of 500 meters, with a logarithmic rolloff. These settings may work for your scenario, or you may find that sources attenuate too quickly or too slowly. For more information, see:

Reverb

The Microsoft Spatializer disables post-spatializer effects by default. To enable reverb and other effects for spatialized sources:

  • Attach the Room Effect Send Level component to each source
  • Adjust the send level curve for each source, to control the gain on the audio sent back to the graph for effects processing

See Chapter 5 of the spatializer tutorial for details.

Unity spatial sound examples

For examples of spatial sound in Unity, see:

Next Development Checkpoint

If you're following the Unity development journey we've laid out, you're in the midst of exploring the Mixed Reality core building blocks. From here, you can continue to the next building block:

Or jump to Mixed Reality platform capabilities and APIs:

You can always go back to the Unity development checkpoints at any time.

See also