Solved

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

Posted on 2009-07-02
5
489 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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