[Openal] Hear sounds in a certain distance range only

Daniel PEACOCK dpeacock at creativelabs.com
Mon Apr 20 02:26:26 PDT 2009





Hi,

There are a couple of options ...

a) The easiest method is to use the Linear Distance (Clamped) Model.  This
model guarantees that a sound will fade from full volume at Reference
Distance to silence at Maximum Distance.  See
http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm#_Toc199835867
 for more details.

b) If you want to use the Inverse Distance (Clamped) Model (the default
model) you'll need to decide what amount of attenuation is 'close enough'
to silence, e.g. -30dB, -60dB, -90dB or -100dB etc ... and compute the
distance which gives this amount of attenuation, e.g. ...

NOTE : The problem with this distance model is that sounds take a long time
to get very quiet due to the exponential roll-off, eg ...

Say your target is -60dB, and reference Distance is 2, rolloff factor is 1

-60dB == 0.001 linear gain.

Inverse Distance Clamped model ...

gain = Reference_Distance / (Reference_Distance + RollOff_Factor *
(Distance - Reference_Distance))

As RollOff_Factor is 1.0 this simplifies to ...

gain = Reference_Distance / Distance

Distance = Reference_Distance / gain

Distance  = 2 / 0.001

Distance = 2000

-60dB is very quiet so you could increase this to say -30dB (which might be
OK if you have lots of other sounds playing at the same time).  -30dB ==
0.0316 linear gain which is achieved at a distance of 63.

Dan
Creative Labs (UK) Ltd.

Notice
The information in this message is confidential and may be legally
privileged.  It is intended solely for the addressee.  Access to this
message by anyone else is unauthorized.  If you are not the intended
recipient,  any disclosure,  copying or distribution of the message,  or
any action taken by you in reliance on it,  is prohibited and may be
unlawful.  If you have received this message in error,  please delete it
and contact the sender immediately.  Thank you.

Creative Labs UK Ltd company number 2658256 registered in England and Wales
at Belmont Road, Belmont Place, Maidenhead, Berkshire, SL6 6TB



                                                                           
             Andreas Bednarek                                              
             <andris at seznam.cz                                             
             >                                                          To 
             Sent by:                  openal at opensource.creative.com      
             openal-bounces at op                                          cc 
             ensource.creative                                             
             .com                                                  Subject 
                                       [Openal] Hear sounds in a certain   
                                       distance range only                 
             04/19/2009 01:05                                              
             AM                                                            
                                                                           
                                                                           
                                                                           
                                                                           




Hello, please is there a property to set for a sound source if I want it to
be hearable in a certain distance range only?

Thanks
_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal

ForwardSourceID:NT0006B4EE



More information about the Openal mailing list