Where was I? Oh yes, realistic audio level over distance.
Building upon the applications, the Audio Level over Distance Theory model was implemented into the Max patch. This segment that was created for an earlier experiment has formed most of this Max patch. The experiment was successful and allowed for the Max/MSP patch to not only create a more realistic attenuation model, but to simplify the part of the patch that receives and translates a playable character’s position.
The theory put into practice in this experiment creates a realistic simulation of audio level over distance and will be put into the final Max/MSP created application. An option to switch between the basic version and the theory version of this audio effect will also be implemented, to allow the end-user to compare the differences.
After weeks, I’ve finally cracked how to receive the location of a static object (currently the ever colourful cube) where an audio source will come from.
The problem was Max/MSP wasn’t updating the location of it when launching the patch, this was because Unity 3D wasn’t sending it any information (it was set to only do so if the object was sleeping, and it only sleeps if its been awake).
I tried waking it up manually, resulting in a horrible mess of jaggery audio (it’s the same script to find the position of the player).
I tried just continuously getting location data, pointless CPU usage and more player position errors.
I tried many other things, non of which worked.
“IT NEEDS TO MOVE. IF ONLY IT MOVED”
…Well move it? I tried, or at least I thought I did. I tried using gravity, to fast and unpredictable. There was no way I could have Unity 3D run the objects movement, because its unstable as I can’t control when people open up the Max/MSP created application. So I ruled out moving it as a possibility.
Then I looked at the basic Max/MSP patch I started the project with. I send it a continuous rotate message. Wait a minute, I sent it a rotate message.
I altered the patch to only rotate the object once, by 0.1. It worked, I could now get the object’s position, which for all intents and purposes of this project hasn’t moved (certainly not enough for any minor changes).
As earlier research stated that with each doubling of distance from the audio source, the volume should attenuate by approximately 6 dB. I decided to compare the result to a very cool plugin called Proximity by Tokyo Dawn Labs and Vladg Sound.
The result is…. It works. Very well in fact. They are similar which means that Tokyo Dawn’s Proximity must use the same algorithm as the general free field conditions. Now to make it work with Unity 3D.
A real world test was completed to demonstrate how audio level over distance typically works within an indoor space. In theory the results should not match with the calculator built-in Max/MSP as they are for free field conditions and other audio properties such as reverberation and standing waves will affect the outcome of the level.
The experiment used 80 dB of white noise (1 metre) as its reference point. The dB SPL of the audio source was measured at each distance increase of a metre. A total of 5 metres was used for this experiment.
As expected, the audio level did not decrease 6 dB every meter. When building the Max/MSP patch, the audio level over distance model will be placed first so that other potential audio level effects (such as reverb) will be added to the signal in a more realistic way.
Although I knew the outcome of the experiment before doing it, I had no proof of the theory not matching with the real world scenario… Now I do.
Below are some images took as part of the experiment.
So I’ve found out that the decibel ratio calculation can be applied using the following calculation sourced from Angus and Howard (2006, pp.17)
Difference in dB = 20*log(Original reference distance/Distance from sound source)
It’s took a longer time than anticipated to form this calculation into a Max/MSP patch, mostly down to user error. Max/MSP is very particular of how things are spelt and expressed.
I also found an easier way to do the calculation along the way. Version 2 will be the version of the “real world” part used for the rest of the project.
Angus, J. and Howard, D. (2006) Acoustics and Psychoacoustics. Great Britain: Focal Press
I’ve got a basic version of audio level working in Max/MSP. Sound decreased the further away from the cube.
One thing I did note was that I was using + (addition) to combine the x and y axis together, which didn’t quite work out how I expected. It would be at its loudest point when directly on an axis than just off to the side of it. I then used the * (multiplication) object and it worked how I thought it would in the first place… You know what? just watch the videos it will make a lot sense than I think I am now.
The first video is using addition and the issue it creates, the second shows how that is fixed by using multiplication instead.
Looking back, it makes complete sense using * instead of +. Now I plan to make it even better, adding in the theory I learnt previously.
As always, here are the downloads to this experiment:
Strangely it is taking me a while to find the answer the question I posed myself last time, “what is the relationship between audio level and distance in terms of decibel measurement?”.
Although there were no lack of resources, I just couldn’t get it in my head.
Real world testing of this proved that other variables are just too powerful, creating unusable results and funnily, unrealistic answers. The answers to the question that I found from other sources were either too simple or way too complicated. Complex maths and formulas may be easy for some people but it just looks like an alien language to me.
I have eventually started to get somewhere though, the Handbook For Sound Engineers Fourth Edition by Glen Ballou states that;
The sound pressure level will decrease 6 dB with every doubling of the distance between a point source and an observer.
For further clarity I have analysed tokyodawn’s Proximity audio plugin. The plugin changes sound in relation to the plugin parameters, one being distance from source. This experiment has resulted in confirmation of that wrote in the book, that 6 dB is reduced when the distance doubles.
The book also gives some suggested further reading material on the topic. Sounds like I’m going to be a busy boy, but at least I’m now getting somewhere.
Some useful links:
Handbook For Sound Engineers Fourth Edition — http://www.amazon.co.uk/Handbook-Sound-Engineers-Glen-Ballou/dp/0240809696/
Proximity audio plugin by tokyodawn — http://www.tokyodawn.net/proximity/