Page MenuHome

Game Engine - 3D Sound Actuator - maximum distance bug
Closed, InvalidPublic

Description

Category: Audio

Conditions:
An Object with 3D sound music moves endless away from the camera.
You will recognize a decrease of loudness.


Lets say you want it to be complete unhearable at the range of 10 and above.
Object with Sound
- Distance: 1 5 10 15 20
- Loudness: 1,0 0,5 0,0 0,0 0,0
You see the option "max distance at which you can hear the sound" and set it to 10.

Unfortunately this doesnt work correct.
-> You can still hear it, no matter how far it goes.
So whats the problem, what does the setting instead:

Pictorially, the sound of the object can not pass the distance of 10 (referring to the camera).
Object with Sound
- Distance: 1 5 10 15 20 25 30
- Loudness: 1,0 0,75 0,5 0,5 0,5 0,5 and so on

Its just an example, the fadeout isnt linear and will never reach zero.
Its more like 1,0 - 0,76 - 0,57 - 0,29 ... (curve)
Have tryed a lot. Even With high rolloff its impossible to get a good/smooth fadeout
when it always fades to infinity.


Attached file:
-Play around with the maximum distance to see.
Most noticable: =1 it wont get lower, =20 sound becomes more quiet, but stops at this distance
-Load a Soundfile
-Start Game Engine

Event Timeline

Moved from Blender 2.6 Bug Tracker to Game Engine

I made some experiments with the sound actuator today, here is some tricks I found :

for the fade issue :
in the scene properties, setup the Listener dropdown to linear clamped

max distance value is not in blender units.
max distance in BU is actually a function using the rolloff and the maxDist values.

the greater the rolloff value, the better the granularity of the volume falloff
rolloff = 200 (enter the value by hand since soft limit is 5) gives good result I think.

if you want volume = 0 at a +- 10BU distance with a good granularity you can setup like this :
ref distance 0.5
max distance 2000
rolloff 200

here's a function Im working on that returns an acceptable value for maxdistance (would need more tuning for very short distances), given the distance you don't want to hear the sound anymore.
constant : ref distance = 0.5 and rolloff = 200

from math import tanh

def soundMaxDistance(m) :
m = max(1,m)
f = tanh(m-1)**5
return m * (100 + ( 100 * f))

distances = [1.0,2.5,4.5,9,45.5,100.5,10.0]
print()
for d in distances :
print(' %s : %s'%(d,soundMaxDistance(d)))

http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835817

Hi Joerg, do you think you could take a look at this? thanks

Hi!

Jerome actually posted the solution himself, this is how the distance models work: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835864

Is there any bug? If yes please explain only the bug and reopen the report, I'm closing meanwhile.

Regards

Joerg Mueller (nexyon) changed the task status from Unknown Status to Invalid.Oct 24 2012, 9:39 PM