Game Development Community

soundfx falloff/distance ?

by Billy L · in Torque Game Engine · 05/22/2003 (12:20 pm) · 7 replies

Hi all !

Is there anybody that got distant ambient sound to work properly ?
I really tried alot ,but no luck !
want the sound to get lower when you move away from it
and higher when you get closer !
Is this working in the engine ?

-Billy

#1
05/22/2003 (2:52 pm)
Ummm... well, this works fine for me, so long as I use an AudioDescription block that has is3D set to true.

I don't know about AudioEmitters yet. Haven't really bothered to try. But the soundfx work just fine for me. In audio.cc, there's an "approximate3dvolume" routine. I just took it out because OpenAL does the job for you so long as you set the appropriate alDistanceModel in the initialization.
Which I believe should already be there.

My init has the following few lines near the end.
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); 
   alListenerf(AL_ROLLOFF_FACTOR, 0.35f);		// soften the attenuation.
   alListenerf(AL_GAIN_LINEAR, 1.5f);
#2
05/23/2003 (10:21 am)
Do you get any linear volum change when you place a audioemitter ?
my sounds turns on and off but i dont get any linear gain !
#3
05/26/2003 (6:53 am)
Yeah, I get some. Although, with a rolloff factor of 0.35, I do have to make the ranges of my emitter fairly large to notice it.

What audioDescription are you using in your emitters? I generally use audioDefaultLooping3D for looping atmospheric sounds.
#4
05/26/2003 (2:08 pm)
Alex can you give me an example on your Audioblock

I really tried alot with this !
I have used default settings and my own Audioblocks,
on one off my maps i have over 20 emitters with differnt
settings and not at single one of them have linear gain
when you approach them !
#5
06/02/2003 (11:51 am)
Here's an example audioprofile for which I get a good linear gain. I'm not really sure where the corresponding audiodescription is defined, though. But this one works fine for me.

datablock AudioProfile(speederEngineSound)
{
  fileName = "fps/data/sound/vehicles/spdrhum.wav";
  description = AudioDefaultLooping3d;
  preload = true;
};

One thing you might want to try is to look at AL_ROLLOFF_FACTOR in the initialization function in audio.cc. Try giving it a value greater than 1.0. And I do mean significantly larger ... maybe even as large as 4 or 5. If you hear a quick linear falloff with that high a rolloff factor and no falloff at all when the rolloff factor is at 1.0, then it suggests that the distance ranges of your emitter are too small.

- Parashar K.
#6
06/03/2003 (12:28 pm)
Distance ranges !

What ranges work for you then ?

I have so many emitters with differnt ranges
So give me some numbers that works
for the

referensDistance
maxDistance
minDistance
#7
06/05/2003 (6:18 am)
Hmmm... well, for "minDistance", we generally clamp it to equal reference distance. But in some cases, it'll be slightly less. With very quiet sounds that we intend to have a larger range, it'll be significantly less.

But for the same audioprofile I mentioned above --
Reference Distance = 10
Max Distance = 60
Min Distance = 5

- Parashar K.