Sound distance v amplitude
This is in a way more of a physics/acoustics question, but I was hoping some kind soul on this forum would know the answer to this.
I’m looking to implement a fairly accurate implementation of sound over distance in my patch, i.e., one dial/slider that controls a sounds amplitude, hf content and reverb/echos.
I’m stuck on how to go from distance (in metres) to amplitude in Max though. So, what I’m looking for, is a way (formula) that takes a float number as input (distance from listener in metres) and outputs amplitude (a number between 0-1) that controls a simple [*~] object. I’m not great at physics, but I’m certain it will involve the Inverse Square Law somehow, but I can’t work out exactly how.
Anyone got any ideas?
if you search here you should find some threads about this topic, they are around 8 years old i think.
there are two main things you should know before you try to connect something to a [*~]:
air damping can vary a lot depending on a lot of things. the main factor is the humidity, and this
parameter is all but linear.
air damping is frequency dependent. it is close to a simple expression but not exactly.
you might find tables with air absorbtion curve parameters on the net. but the use of tables
gets problematic as soon as you want to modulate the distance.
i have always used a biquad mixed with the original, like in the picture below. you might want to
copy and test that with your ears.
the right input takes up to 50 (meters) as input.
the damping is an average set by will/ears.
the filter coefficients were taken by someone else back in the days.
[p t] is nothing, the expr goes into both *~s.
Many thanks for your reply. I was aware of the different ways that air affect a signal, and through a bit of research and compromise on temperature and humidity will hopefully have that side of it sorted.
So, looking at the attached patch, are you at all able to explain what is going on in that expression? And why does it change the amplitude twice (using two [*~]s)? Why does it only work for up to 50?
That said, it certainly sounds pretty good to me as far as volume attenuation, tho I’ll probably look at other ways of doing air absorption.
its been done twice only because there are these two paths, one with that lowpass and one without, which are making a somewhat realistic "power"-depending filtercurve when summend up again.
it is been done twice because after the first [*~] it is going to the filtered version, too. so now there is a fixed relation between the two branches.
one could probably use 6-8 (variable) filters right on the input to get something similar.
after the first [*~] that would be the point where you could now change the filter and/or the gain reduction by inserting your "fogginess" or "mercury barometer" parameters.
a pressure parameter isnt worth at all, and the nonlinearity of real fog is complicated. :)