Sound in 3D

addam davis
3 min readJun 5, 2024

--

Objective: Understand how to make sound in a 3D space.

Today’s tutorial we are going to be continuing our work in VR. If you have been following along that we have been working on creating a revolver that does all the things a revolver would do. This time, we are adding sound. If you have not been following along don’t worry this will still help you with your 3D audio.

To begin, select the object you are wanting to create audio for (the revolver) and we need to add an audio source component.

Super simple, next, we need to uncheck the box for ‘Play On Awake.’ For this instance, we only want the sound to activate when we press the activate button.

So far so good. Now, we need to add our audio clip. So, take whatever sound effect you have in your project, and we are going to add it to the AudioClip at the top.

With this example we are going to be adjusting the Spatial Blend option below. Spatial blend set how much the audio source is treated as a 3d source. 3D sources are affected by spatial position and spread. By default, this is set to 0 which ignores all spatial attenuation.

With background music or narrative dialog you would not need to worry about using spatial blend. But, for game objects in the game space it gives your game a more realistic feel and allow you players to lose themselves more easily in your environments.

We now need to set when this sound will go off. When does a revolver typically make the shooting noise? When the revolver is shooting is a pretty good place starting point. We can simply add a new event under the Activate Event.

Drag the Audio Source into the object section.

Now the function we want is under the audio source and we simply want the play function. This will cause your audio source to play every time you “Activate” the revolver.

Now when you use the revolver the sound clip will sound off and depending on where you are relative to the revolver the audio clip will sound different. Now you know how to create 3D sound in your VR environment. Don’t be afraid to experiment with your 3D sound and I’ll see you in the next tutorial!

--

--