[Openal-devel] _AL_CUTOFF_ATTENUATION

Ed Phillips ed at udel.edu
Wed Dec 14 12:18:11 PST 2005


Hi,

On Wed, 14 Dec 2005, Ed Phillips wrote:

> Hi,
>
> On Wed, 14 Dec 2005, Sven Panne wrote:
>
>> The problem with AL_INVERSE_DISTANCE is the jump from +inf to -inf
>> around
>> 
>>   distance = referenceDistance * ( 1 - 1 / rolloffFactor )
>> 
>> Probably the gain should stay at a maximum float value when the distance
>> approaches zero (avoiding a discontinuity), but that is not in the spec.
>> Sorry for being so picky sometimes, but I need to know what to do to
>> implement it correctly and consistently with other implementations.
>> 
>> For the curious ones, I've attached a gnuplot batch file and a
>> PostScript plot showing the effect of the various distance models.
>
> I glad to see a bit of discussion on this...
>
> FWIW, using this stuff in a practical situation, I know I spent several long 
> nights with gnuplot trying to understand and predict the effect of the 
> various attenuation schemes while working on the OpenAL support in our game. 
> I ended up using the regular AL_INVERSE_DISTANCE falloff with a rolloff value 
> computed to produce -18 dB gain at max distance.  For our sound emitters, we 
> specify ref distance and max distance - with the notion that ref distance is 
> the "near" distance to the emitter (with gain = 1.0) and max distance is 
> actually were we want the sound source to be culled (and at gain = 0.0).  So 
> to implement this, we needed to add a function to attenuate the sound source 
> near max distance by altering the gain as the listener-to-sound-source 
> distance approaches max distance.

One detail I forgot - we found that in this scheme, choosing maxDistance 
close to 10 * refDistance seemed to give us the nicest sound attenuation 
curves, so we use that as a "rule of thumb" when setting up our sound 
emitters.

Cheers,

 	Ed

Ed Phillips <ed at udel.edu> University of Delaware (302) 831-6082
Systems Programmer III, Network and Systems Services



More information about the Openal-devel mailing list