Solved

Calculate Volume at Listener's Position for a 3D-Sound

Posted on 2009-07-02
5
488 Views
Last Modified: 2013-12-26
Hey there,

I'm about to implement 3D-sounds for our game engine. Getting the panning right was quite simple. I'm struggling on finding a more/less accurate formula on how to calculate the volume in respect to the distance to a sound-emitter. I guess its not linear, is it?
I've already tried to google and to look at the OpenAL sources, not much luck so far.
For the sake of simplicity, our emitters emit the sound in 360 degrees, so the emitter has no direction.

Thanks in advance
ike
0
Comment
Question by:ikework
  • 3
  • 2
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 24761290
if you are not concerned with thing like reflections, intensity drops as the square of the distance.
But perceived intensity is approximately logarithmic, so doubling the distance drops the intensity by about 6 dB and 10 times the distance drops the intensity by 20 dB.
0
 
LVL 20

Author Comment

by:ikework
ID: 24761482
thx ozo .. our underlying sound-system can have values from 0..1024 for the volume.
the docs say:
"1024 is the original value, volume scale is between 0 and 1024 with 960 being a -6db drop"

so what i understand from your post is something like this:

volume = 1024 - (sqrt(distance)*scale)

if scale == 6.4f we had a drop of -6dB at 100 units distance

you think that would be ok?
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 24761543
I don't know if it would be ok, but it's not what I said.
You should get a drop of about -6dB every time you double the distance, which would be more like
volume = 1024 - (log(distance)*scale)
0
 
LVL 20

Author Comment

by:ikework
ID: 24761598
great, i see
0
 
LVL 20

Author Comment

by:ikework
ID: 24762091
In case, anybody else has this problem too, this link was very useful to me, basically the same as ozo said. you can plugin values in a calculator and test your own values.

http://www.sengpielaudio.com/calculator-distance.htm

Thanks ozo :)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How Complex Is This Java Course ? 11 113
max float value 3 42
Error creating a new C++ project in ,net 20 36
Why  my code (program) build with old compiler? 11 48
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question