Adding ambient audio
The VIVEPORT Scene SDK provides the component Vive Object Audio Ambience (Script) to add ambient sound to your scene. We recommend that each instance of the component be used for similar sounds, such as bird song used in one object, and then using other ambience such as wind or creaking trees, in a separate components.
To add the ambient audio:
- In Unity, create an empty GameObject in the hierarchy by clicking Create > Create Empty .
- Select your new object, and then rename it Ambient Audio in the Inspector window.
-
Click
Add Component
, and then add the following:
- Audio Source
- Preview Audio Context (Script)
- Vive Object Audio Ambience (Script)
- In Vive Object Audio Ambience (Script), click Ambient sounds to expand. Type the number of sound files you’ll add into the Size box. You can change this number at any time.
- Drag your audio files to the boxes labelled Element __ .
-
You can adjust any of the following settings:
- Time minimum – minimum amount of time that will pass before a sound will trigger.
- Time maximum – maximum amount of time that will pass before a sound will trigger.
- Sound volume – Sets the audio source volume between 0 and 1. See the tips in Adding audio for recommended values.
- Sound distance – Determines the maximum range of a sound and attenuates the minimum distance.