We can use the sound occlusion feature that was added to Unreal Engine 4.11 to automatically drive a Game Parameter of a FMOD Event. By automating the volume and the low pass filter frequency in the Game Parameter, it is possible to achieve a sound occlusion effect on that specific Event. Let’s go through the steps to set up this behaviour.
Audio Occlusion setup in FMOD Studio
The occlusion system works by driving a parameter of our choice in a specific Event. Let’s create a continuous parameter named Occlusion with a range from 0 to 1. After that, insert a Gain and Multiband Equalizer Effect to the Master Track of the Event and automate the gain and the default low pass filter frequency so that both values are lower at the parameter value 1:
Why 0 and 1 in the first place? The occlusion system in Unreal Engine 4 is based on a binary raycast, therefore the parameter will be set to the value 1 when the sound is occluded and 0 when it’s not. Set the seek speed of the Parameter to around 3.50/s so that the parameter change is not instant.
Audio Occlusion setup in Unreal Engine 4
In Unreal’s FMOD Studio preferences, we have to set the name of the parameter that will be used for the Occlusion behaviour. In our case, let’s input Occlusion into the Occlusion Parameter field:
To test the behaviour create a simple level with a FMODAmbient Actor and a simple wall between the audio and the player:
After that, we can enable Occlusion for an Event that has the occlusion parameter already set up by selecting an FMODAmbient Actor and clicking on the Enable Occlusion checkbox under the FMODAudio properties:
The object containing the Event will now perform raycasts against collision geometry to determine if there is an object between the sound and the listener. If that is the case, the parameter of the FMOD Event will be set to 1. As demonstrated in this video example, move to the left and right side of the wall to listen to the occlusion effect taking place: