- Home /
how is the volume of an audiosource computed?
I'm working on a serious-game, where we have to do some exact audio measurements.
What I have is an audio file with a reference decibel value. So if I play this audio file with the volume of the audiosource set to 1, I should have an output decibel value of the reference value.
Now I want to reduce the volume by let's say 20 decibel. How would I do that? My guess was doing it with the formula:
volume = referenceValue / wantedDecibel
I got the following result (software value / measured millivolt / measured decibel):
Does anyone know what exactly the formula behind the volume 0..1 of an audiosource is? and how I could convert it to decibel values if I know the maximum decibel value of the soundfile?
I would appreciate if you comment any thoughts and guesses on the matter :)
thanks & cheers
Answer by gabhead · Jul 29, 2011 at 03:13 PM
Well if you use 2D sound then the volume is going to be linear interpolation 1 being your total file db and 0 being no sound.
If you have a sound of 120db and you wand it to play at a exact 70db you'll use: (wanted_Db/Total_DC) (70/120) as volume 0.58333.
That said, you'll have to measure your speakers output to be the same as the audio file (At the listener position).May be there you should use a db measurement tool.If you don't you'll have to calculate not only the good voltage for speakers but also the inverse square decay law...
At that point i would prefer headphones.
I wish it helps. good luck
fortunately we have a db measurement tool to calculate the overall system db offset. :) I'll try and do another test with the linear interpolation formula.. Thx for the reply!
ok, I checked my formula and in fact I just did what you suggested. The measured dB output doesn't interpolate correctly.. I'll update if I find anything.