Today we’re looking at the distance parameter within FMOD. The great thing about the distance parameter, is that it requires no code to set up and instead just requires a listener and an emitter component. What the distance parameter does, is that is checks for the distance between where the FMOD listener is and the emitter that the parameter is applied to. This lets you change a sound depending on how far away it is from you, which is pretty awesome! Heads up, I’ll be using Unity to demonstrate this today. Let’s get started!
First of all, for the example I’ve made a quick little Unity project where I animated a helicopter flying by the player, which looks like this;
Try setting up a similar thing before we move on. If you want to keep it simple, you could just animate a simple cube performing some sort of movement. Quick tip, if you need a first person player, download the “Standard Assets” package from the Unity asset store, there’s tons of great things in there, including the player.
Next up, go into FMOD and set up as many 3D events as you need.
For the Helicopter I ended up with six 3D events, but if you chose to only use a single cube you might only need one.
When you’re clicked on an event, you can press the little “+” symbol next to “Timeline” to show you all the parameters that you already have in the project, including the option to make new ones. Whenever you create a new parameter it will show up here, making it easy to quickly access any parameter from any event.
So, navigate down to where it says “New Parameter” in the bottom left corner and click it. This window (called “Add Parameter”) will show up;
As you can see, there are a bunch one built-in parameters that you can use straight away, we’ll be looking at the other ones in the future. For now, click on the “Built-in: Distance” parameter, then click “OK” to add it to that event. Remember, you need to do this for every event you want to respond to the distance.
Now simply add the sounds you want to use in each event. For my example, I needed six looping mono sounds, which are going to be placed on different parts of the Helicopter.
Inside of Unity, add the “FMOD Studio Listener” component to your player or camera and simply add a “FMOD Studio Event Emitter” component to wherever you want the sound to play from (in my case the Helicopter, maybe the cube in your case).
Now everything is set up for you to try automating a bunch of audio parameters with the distance parameter. Make sure this is all set up for you before we move on.
Automating Audio With Distance
To automate any parameter in FMOD, you simply need to right-click on whatever you want to change and then click “Add Automation”. You can do this with almost everything in FMOD, every plugin, every track and so forth. Try just adding volume automation to start with.
Now, to control how the volume will respond to the distance data, click on the “Distance” parameter next to “Timeline” in the top. You’ll see a red line next to the volume track, you use this to control how much volume you want at any given point. Try drawing in any curve you like and see how it responds in-game. It might take a couple of tries to get a result that you’re happy with. Look at the picture below if this is unclear.
I chose to automate the volume, the “sound size” on my Spatializer and a low pass filter for most of my Helicopter sounds. If you’re feeling brave (which I know you are!) try just adding some plugins or whatever you feel is appropriate, then automate some of the parameters on those.
Example and Exercises
Here’s what I ended up with for the Helicopter. There is of course a ton more things you could have done with this, but it’s Christmas so give me a break!
- Create and Animate a cube in Unity (or Unreal), give it a single 3D emitter and automate some parameters on that, with distance.
- Take a bigger object (like a Helicopter) and place multiple 3D emitters on it. Again, automate each of those so that it sounds good and smooth.
- Here’s a fun one! Animate maybe 5-8 cubes and make them spin around the player. Put a single 3D emitter on each, automate some parameters with distance and let the mayhem being!
- Inside of FMOD, apply the distance parameters to 15 sounds.