The Oculus Native Spatializer Plugin (ONSP) is an plugin for Unity that allows monophonic sound sources to be spatialized in 3D relative to the user’s head location. In addition, you can use the plugin for audio propagation, which provides real-time reverb and occlusion simulation based on game geometry.
The spatializer ships as a part of Oculus’s integration package for Unity or can be downloaded and enabled as a standalone plugin.
For a detailed discussion of audio spatialization and virtual reality audio, you can review the Introduction to Virtual Reality Audio guide. If you’re unfamiliar with Unity’s audio handling, be sure to review the Unity Audio guide.
You can either download the spatializer as a stand-alone utility, or install the Oculus integration package, which includes the spatializer.
Import the Oculus Integration Package
-OR-
Download the Oculus Spatializer Unity package from the Audio Packages page.
Whether you use the Oculus integration package, or download only the audio package, follow these instructions to enable the spatializer.
For Rift, set DSP Buffer Size to Best latency to set up the minimum supported buffer size for the platform, reducing overall audio latency. For Quest, set DSP Buffer Size to Good or Default to avoid audio distortion.
The following image shows an example of the Rift setting:
Note: Be aware that CPU usage increases when early reflections are turned on, and increases proportionately as room dimensions become larger.
Follow these instructions if you need to update the version of the plugin that you are using.
OSPAudioSource.cs
(from previous OSP) on AudioSources with ONSPAudioSource.cs
in {project}/Assets/OSP
.OSPManager*.*
from {project}/Assets/OSP
except your newly-added ONSPAudioSource.cs
.Use the functions on AudioSource to start, stop and modify sounds as required.