Unity tutorials - sound in VR
https://learn.unity.com/tutorial/unit-7-sound-in-vr?uv=2018.4&courseId=5d955b5dedbc2a319caab9a0#5da89cffedbc2a03c51594e5
Add Oculus Spatializer Plugin
- Binaural Synthesis - uses a head-related transfer function (HRTF), which accurately simulates how sound arrives at the ears, including the delay between them and appropriate frequency filtering
- Spatial audio is critical to VR as it reinforces the visuals, helps fill out parts of the world that lie outside the field of view
- Open the Escape Room vertical slice
- Edit>ProjectSettings>Audio>SpatializePlugin set to 'OculusSpatializer'. Set DSP Buffer Size to 'Best Latency'. Default speaker mode>Stereo
- Add a sound to the scene by creating an empty game object and adding an audio source to it
- Create three empty game objects
- Select object>add component>AudioSource>Duplicate Game object three times
- Rename first object 'TeleportSound'>Search for audio file (in this case Escape Room, Audio) drag teleport Audio clip to 'Audio Source'> Audio Clip field
- Hierarchy>Teleporter.Instant>TeleporterFacade>add new EventDate action for the Teleporter Event Data action list. Assign the first Audio Source game object (in this case Teleport Sound) to the new slot>Function>AudioSource>Play
- Rename second game object 'Victory'>add component>Numpad Logic (script)>add slot>drag game object 'Victory_Sound' into new slot>function>AudioSource>Play
- Rename third game object>Creepy>drag'amb_lab_loop to the audio clip slot>add componenet ONSP Audio Source script>Spatialization enabled check>Oculus Attenuation enabled check> minimum range to object 0.25 (larger the number less of the sound will be heard closer to the object maximum range set to 10
Add Reverb and Mixer Settings
- Reflections can be performance heavy, especially on Oculus Quest. Use sparingly. Good for short sharp sounds, not so much for long sounds. To enable, check the 'Reflections Enabled' box in the ONSP Audio Source component
- Reverb - more reverb indicates spaces that are far away. Short reverb indicates close proximity to the listener
- Before adding the reflection engine to a scene you must create a mixer channel and add the Oculus Spatializer Reflection Plugin effect to that channel.
- Create by >Assets(top menu)create>AudioMixer>double-click>(opens Master)>click>inspector>add effect>OculusSpatializerReflection
- Go back to creepy sound>AudioSource>Output>click on dot to right of field and select Master (New Audio Mixer)
- Master New Audio in inpector> Global Scale of the Oculus Spatializer Reflection is set to 1m
- Enable Early Reflections and Reverbation global settings will affect all reflections and reverb in the scene
- The room dimensions control reverb for all sounds
- Save
- Test in VR
- Unable to test! Problem with loading. Disabled the sounds and some progress with loading. Shut down Unity and will try again
Comments
Post a Comment