?
Solved

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

Posted on 2009-07-02
5
Medium Priority
?
495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

777 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