Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now