Solved

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

Posted on 2009-07-02
5
491 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 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

691 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