OpenAL Specification and Reference | ||
---|---|---|
<<< Previous | State and State Requests | Next >>> |
Samples usually use the entire dynamic range of the chosen format/encoding, independent of their real world intensity. In other words, a jet engine and a clockwork both will have samples with full amplitude. The application will then have to adjust Source GAIN accordingly to account for relative differences.
Source GAIN is then attenuated by distance. The effective attenuation of a Source depends on many factors, among which distance attenuation and source and Listener GAIN are only some of the contributing factors. Even if the source and Listener GAIN exceed 1.0 (amplification beyond the guaranteed dynamic range), distance and other attenuation might ultimately limit the overall GAIN to a value below 1.0.
AL currently supports three modes of operation with respect to distance attenuation. It supports two distance-dependent attenuation models, including one that is similar to the IASIG I3DL2 (and DS3D) model. The application chooses one of these two models (or chooses to disable distance-dependent attenuation) on a per-context basis.
Legal arguments are NONE, INVERSE_DISTANCE, and INVERSE_DISTANCE_CLAMPED. NONE bypasses all distance attenuation calculation for all Sources. The implementation is expected to optimize this situation. INVERSE_DISTANCE_CLAMPED is the DS3D model, with REFERENCE_DISTANCE indicating both the reference distance and the distance below which gain will be clamped. INVERSE_DISTANCE is equivalent to the DS3D model with the exception that REFERENCE_DISTANCE does not imply any clamping. The AL implementation is still free to apply any range clamping as necessary. The current distance model chosen can be queried using GetIntegerv and DISTANCE_MODEL.![]() | Annotation (Inverse Square Law) |
---|---|
The "inverse square law" used in physics applies to sound intensity (energy), which is proportional to the square of linear gain (amplitude). Thus the inverse distance model describes a physically correct inverse square behavior if ROLLOFF_FACTOR is set to 1.0. |
![]() | Annotation (Enable/Disable Attenuation) |
---|---|
As ROLLOFF_FACTOR is a per-Source attribute, setting it to zero can not be used to globally enable or disable distance attenuation, which (e.g. when using tables) can be resource intensive. Using Enable/Disable/IsEnabled with a DISTANCE_ATTENUATION token is redundant with respect to the possibility that support for different distance models might be desired at a later time. |
The following formula describes the distance attenutation defined by the Rolloff Attenutation Model, as logarithmic calculation.
G_dB = GAIN - 20*log10(1 + ROLLOFF_FACTOR*(dist-REFERENCE_DISTANCE)/REFERENCE_DISTANCE );
G_dB = min(G_dB,MAX_GAIN);
G_dB = max(G_dB,MIN_GAIN);
![]() | Annotation (Linear Calculation) |
---|---|
The logarithmic formula above is equivalent to dB = 10 * log( P/P0 ) = 10 * log( sqr(A/A0 ) = 20 * log( A/A0 ) |
![]() | Annotation (Rolloff quantization) |
---|---|
Implementations that use lookup tables to speed up distance attenuation calculation may opt to map ROLLOFF_FACTOR to a limited set of internally used values, to minimize expense of per-Source calculations and setup/memory costs. |
![]() | Annotation (Gain Clamping) |
---|---|
In the absence of user MIN_GAIN and MAX_GAIN selections, clamping is implied by implementation constraints, and clamping behavior might change. The AL implementation should not clamp intermediate values of effective gain to unit range. Any clamping, if necessary, should be applied at the latest possible stage. In other words, GAIN>1 is perfectly valid as the implementation is free to clamp the value as needed for maximum mixing accuracy and to account for the actual dynamic range of the output device. |
![]() | Annotation (Extended Dynamic Range) |
---|---|
For applications that change GAIN but do not want to adjust ROLLOFF_FACTOR and REFERENCE_DISTANCE to account for different ranges, the separation in this distance model might allow for more intuitive adjustments: If we put a damper on the jet engine by lowering GAIN, we still want the listener to perceive the full volume, but now at a closer distance, without changing the reference distance. |
This is essentially the Inverse Distance model, extended to guarantee that for distances below REFERENCE_DISTANCE, gain is clamped. This mode is equivalent to the IASIG I3DL2 (and DS3D) distance model.
dist = max(dist,REFERENCE_DISTANCE);
dist = min(dist,MAX_DISTANCE);
G_dB = GAIN - 20*log10(1 + ROLLOFF_FACTOR*(dist-REFERENCE_DISTANCE)/REFERENCE_DISTANCE )
G_dB = min(G_dB,MAX_GAIN);
G_dB = max(G_dB,MIN_GAIN);
![]() | Annotation (DS3D MIN_DISTANCE) |
---|---|
The DS3D attenuation model is extended by an explicit clamping mechanism. REFERENCE_DISTANCE is equivalent to DS3D MIN_DISTANCE if the INVERSE_DISTANCE_CLAMPED mode is used. |
![]() | Annotation (High Frequency Rolloff) |
---|---|
To simulate different atmospheric conditions, a frequency dependent attenuation is used in A3D and EAX. At this time AL does not have a mechanism to specify lowpass filtering parameterized by distance. |
<<< Previous | Home | Next >>> |
Space and Distance | Up | Evaluation of Gain/Attenuation Related State |