Friday, August 31, 2018
Unity3D & spatially based audio reverb
Spatially based audio reverb is an audiosource echoing in a way that helps the listener determine the spatial location of the audiosource. This is the most helpful in VR applications where a listener can see the shape of the room. Seeing the shape of a room helps the listener predict how a sound will echo in it. I've been working with applying spatially based reverb to a project. Initially I set out to use a *.unitypackage provided by Oculus, ovr_audio_spatializer_unity_1.27.0 https://developer.oculus.com/downloads/package/oculus-spatializer-unity/ . I ran into some difficulties getting a basic reverb to work. A colleague mentioned Unity comes with a primitive version of the OculusSpatializerReflection effect from this package. I set out to give the in-built version a try and had success. The in-built version of OculusSpatializerReflection doesn't have as many features as Oculus's *.unitypackage. The major feature missing is the *.unitypackage allows you to define the location of the shoebox creating the reverb. The AudioListener can move freely inside of the shoebox. The primitive version built into Unity does not support that type of AudioListener movement. Instead it always has the AudioListener at the center of the shoebox creating the reverb. However, the primitive version is quite a bit easier to setup.
OculusSpatializerReflection setupTo set up OculusSpatializerReflection from a completely empty Unity project:
- Edit -> Project Settings -> Audio -> spatializer Plugin should be set to OculusSpatializer
- In the project panel, Right click -> Create -> Audio Mixer
- Add an OculusSpatializerReflection effect to the Master channel of the AudioMixer that you just created. Then setup that effect to be a very reflective hallway using the following properties: GScale: 1 - this value is essentially a multiplier from the Room XYZ E.Rflt On: 1 - E.Rflt stands for Early Reflections. They help bring out the spatial aspect of the reverb E.Rflt Rev On: 1 Room X: 16 - Here you want the room to be like a big church. The algorithm doesn't handle long hallways well. Room Y: 16 Room Z: 16 Left: 0.97 Right: 0.97 Up: 0.97 Down: 0.97 Behind:0.97 Front: 0.97 Shared Rev Min: 1 Shared Rev Max: 10000 - This seems to be the value corresponding to when echos get cutoff. Maximize this to ensure you get as few echo cutoff as possible.
- Create a new scene, the camera should be left at it's default position of 0, 1, -10
- Add an empty game object at 0,0,0 that has an AudioSource component with: AudioClip: set to any audioclip you want to test with, vocal1.ogg from the OculusNativeSpatializer.unitypackage worked well for this Output: Master (This is the channel of the audio mixer you created in step #2) Spatial Blend: 1 Spatialize: checked
Subscribe to Posts [Atom]