Spatial AudioFMOD Spatialization/Binaural, HRTF

Hello, its me again.
I am still developing the racing game. It came to my ears the sound of the cars sound somewhat flat, especially the player car. it is a mono sound source and you do hear a little bit of panning while playing but it really doesnt knock anybody off the socks, so to speak.
So I read a little bit about HRTF and spatialization, also about Resonance Audio but I am not sure which is a free and the most easy way to create this phasing/reverbation when an object moves around your head in 3d space.

Can you give me either THE go to solution or a few ideas, what is common, what is easy to use and ready with FMOD and Unreal Engine 5.

Best regards.

PS I tried steam audio and noticed that both the distance falloff of the plugin and the event macro min max distance are applied where i cannot disable the macro or change the curve it uses. Any ideas?

Resonance audio is probably the simplest (though not necessarily the “most detailed”) way to handle implementing HRTF and ambisonics. It is free and open source - the project is publicly available at the resonance-audio github repo, which also contains the license.

That said, another solution (that could be used in tandem with better spatialization) would be to simulate the car sounds in more detail than just a single mono sound source. For example, you could also have audio for different parts of the car (engine, intake, exhaust), potentially in stereo, as well as controlling aspects of the the sound (filtering, reverb, etc.) using parameters in specific situations, e.g. when the car is driving close to a wall on one side.

Can you elaborate on what exactly you mean?

Sorry for replying so late. I fiddled around with the SteamAudio plugin and I am very happy with it on stereo (except unreal engine crashes when the editor is closed because of the steam audio plugin, some module registration problem).

So another question arises. I put the Steam Spatializer into every single event that needs it.

But what if the user decides to use a different channel layout, say 5.1 or surround-sound of headphones. How would one switch to the original FMOD (object) spatializer? This must work at runtime. Do I really need to keep track of all events and plugins in it and bypass them on condition whenever the option is changed?

Best regards.

I assume this is because the Steam Spatializer always outputs in stereo? Unfortunately there’s currently no “simple” solution, though effect-level wet/dry mix control is a feature that we’re tracking that would handle your use-case, and I’ve noted your interest internally.

One way to do it would be to specify a speaker layout as a platform setting, create separate platforms for each layout, and then use platform exclusion to exclude the desired plugin. However, by the sound of it, this wouldn’t work for you - i.e. if the user switches at runtime.

The best way to handle this at runtime that doesn’t involve digging into the Core API DSP chain yourself would be to make use of event-level sends and/or track routings to duplicate your audio signal and spatialize each copy with each spatializer. You could then use a global parameter to drive muting each signal - i.e. by automating send level, track volume, etc.

1 Like

Okay so I checked the programmatic approach. Just cache the DSPs at runtime in variables and bypass them on condition. The thing is now: Why the heck, in the …


…only the callback for the steam audio spatializer happens, but not the FMOD 3D Object Pan? The effect is literally right behind the Steam Audio plugin in the DSP chain as well as it is visualized in the FMOD Profiler.

Is it because this effect is rerouting the sound to somewhere else like mentioned here?

is it even possible to disable this via code?

Edit.: Ah I forgot but found: Due to the FMOD magic I can find the Spatializer DSP on some channelgroup. nice.

Another question regarding this: Is FMOD_STUDIO_EVENT_CALLBACK_STARTING safe to use instaed of FMOD_STUDIO_PLAYBACK_STATE::FMOD_STUDIO_PLAYBACK_PLAYING to check wether the DSPs are created? also, when the event pauses or so, is it safe to hold the pointers to the DSPs or do I have to refresh them everytime eg. the event continues or so?

FMOD_STUDIO_EVENT_CALLBACK_PLUGIN_CREATED only fires for plugin effects, such as the Steam Audio Spatializer, Resonance Audio Source, etc. and doesn’t fire for any of FMOD’s built in effects.

The underlying DSP structure of the event will have been created before FMOD_STUDIO_EVENT_CALLBACK_CREATED fires, so you should be able to use that callback instead of STARTING or PLAYING.

It should be safe to hold the DSP pointer until that DSP is destroyed.

1 Like