Showing posts with label Audio. Show all posts
Showing posts with label Audio. Show all posts

Tuesday, December 13, 2016

Adding Background Sound (or Music)

Adding background (ambient noise) or perhaps music to your scene is a simple of matter of adding an Audio Source to your Main Camera.

If you camera object does not already have an Audio Listener, then you will need to add one.

In this way the sound will always be prevalent instead of based on how far or near you are to the source.

Add a Spatial Sound

Making use of the Google Cardboard SDK, you can add spatial sounds to your scene that react to head direction changes.

You can add a spatial sound in two ways:

  • Drag a GvrAudioSource prefab into your scene
  • Add the GvrAudioSource script to your object
Ensure that your project settings have the Audio value of Spatializer Plugin set to the GVR Audio Spatializer.

Edit > Project Settings > Audio


You also may have to enable the GvrAudioListener script that resides on the GvrMain > Head > MainCamera game object.  This is provided as a part of the prefab.

At this point, when you play your game, you should hear the sound (assuming the source is in range), and as you turn your head, you should hear the sound move accordingly.