Custom Air Absorption over Distance System - Dissertation Help

**Hi there, I’m looking for some advice with my university dissertation project. **

**My project is looking into implementing a system in the unreal engine to accurately simulate the air absorption of sound over distance, and to experiment to see whether or not this actually makes a game more immersive. **

**I’ve been struggling to get the system working and have tried multiple approaches. Currently the idea for the system would work as follows: **

Preset atmospheric variables from the scene (pressure/temperature etc) are read, and passed to an equation, which calculates the dB per metre roll off at octave bands, (this isn’t finished btw so I’ve not included a screenshot of this part).

**This calculation is done for each frequency band, then scaled depending on sound cue distance from player. The individual results (as floats) are then passed to an array, which makes an interpfloatcurve object.

https://lh3.googleusercontent.com/Hc4HLOieHBMu4p-9Qgxlt4tHN3BnL4DYqvTT9t_9Q6kh3PQxpx4mol3Zf8hX2ysRFDOdLhOl4jZ4JauZR5oJor0B5GPeMXaYei_o6npvzN8Ysuvk3huYIZZADAdaM17MfE4mPjAF

**

**The problem is what comes next. I’m attempting to use the interp float curve that’s been created via this array to modify the shape of a low pass filter on the sound I’m wanting to affect. **

**To try and implement this, my thought process has been to try and change the filter values of a “sound attenuation settings” object connected to a sound cue in game. I’ve done this by referencing the “sound attenuation settings” object I made in the content browser, “setting members” and then tried to make my array data plug into the “Custom Lowpass Air Absorption Curve” pin. **

**

https://lh6.googleusercontent.com/J_uy0Gt40M47pW7yHPLTM-15xNGATAHdeh0VkbfrgAOKNuJBBJQmWDwY8bgAjjKPu_rwAHAitEUozV3X1couWMSG4ZOR3FSzEYsCTtnAktWMvSIOhRO74bqf01W9QWYGehJUMRY4

**

**The problem being that my array outputs an “Interp Curve Float Structure” **

**

https://lh6.googleusercontent.com/xzZkDDCltkU4GhHBjWTrN3jkpkxhqqf9FlwxegprTJeBuYejiqQ4iALhtkMDiRNSHbxWDkdINE9XgJaf8fijd9LOSIUQaaihUDLXX-JU42FEGNhHgnvj0OKBD8JmpvTozcygaZ0n

**

Whilst the input of the “Custom Lowpass Air Absorption Curve” set members asks for a “Runtime Float Curve Structure”

**

https://lh5.googleusercontent.com/SNHl701ZRrEorOI3i2IJ4ohP9ToeDVhmYDA6pnhRmFWUMUZ1g3zXsJLvmN5FPqgP3xeGMt1Crr_ytGnmOs7saDzi4Yy5PnrNish1tWx0lD2B20jO21847DJD246fp_MnjHmn7s_l

**

**Is there a way to get around this issue, and do you think I’m heading the right way with this whole thing? **

I would be incredibly grateful for any help anyone can give me!

Many thanks,

Marcus

I am not sure if you are on the right track concerning your overall project. I don’t know where your focus is during your work. So I can’t answer that.

Although the different types of curves are very similar, unfortunately I also don’t see a way to get this done in blueprints only. So a bit of digging into C++ is necessary here.
If the data is static or a one time calculation, your overall direction should be fine. Although I haven’t looked into the sound aspect of unreal that deep. FRuntimeFloatCurve contain a UCurveFloat (there InFloat value equals “time” and OutFloat equals “value”), that can be created in the editor with a nice UI. (ContentBrowser -> Miscellaneous -> Curve -> CurveFloat)

In C++ create a FRichCurve and put it in a UCurveFloat. Thats what you are editing when using the editor window for curves. So you have additionally the option of choosing the interpolation method between your data points. Then you can create a FRuntimeFloatCurve with that.

Remark: Do the multiply by distance after evaluating the curve, then the curve can stay static. Although, if you have written the function to create the curve, it may also be feasible to do it the way your blueprint shows.

Start by creating an AActor class, where you can add a UCurveFloat as an UProperty() so you can easily use it in the blueprint editor if you like. Or even better: derive your blueprint from that actor. BP editor -> Class settings -> Parent in the panel on the right.

To see how to handle the mentioned data in code, look up its uses in the engine. I found good examples at:
Engine\Source\Editor\UnrealEd\Private\FbxAnimUtils.cpp - Line 161-164, calling a function AddRichCurve() in
Engine\Source\Runtime\Engine\Private\CurveTable.cpp - Line 522
For the rest of UE4 C++ stuff look up the one of the many tutorials on the internet or take a look at one of the many actor classes.
A IDE like VisualStudio and UE4 source code is the way to go to navigate through the difference source files and classes more comfortably (Intellisenses “Goto definition” is a good friend)
Sorry if those last statements where too detailed, but I assume entry level … don’t know your knowledge level.

I was interested in the topic a while ago and found interesting works for example by “Sound Synthesis and Propagation | GAMMA” (Chapter: Interactive Sound Propagation). For example Steam Audio API that is also integrated into Unreal, are thinks related to this and of course not achieved by one person. It seems there is a trade off to be made between pre-calculations, so memory vs. runtime calculation costs.

Take care on your journey!

I have some thoughts to share, if you don’t mind. Maybe it will be good to use data of pressure, temperature to dynamically change EQ (attached to Actor) depend on distance between listener and Actor and set Falloff distance in Attenuation settings of Actor. Than you can manage Frequencies that dies because of distance in specific game situation. It is not so advanced algorithm but I hope it will give you more accurate result of your experiment.
For example, player teleported from Earth to Mars step to surface with less athmosphere dencity (if it is right word for it)).
You need to apply these changes to reflect sounds as well as initial sound of Actor, it is interesting to apply it to procedural reverb.

Hi guys, thanks for this. I’ll do some digging around and see what I can find.
If anyone else finds this thread and has any other ideas please feel free to share, I’d love to hear them!