Attenuation By Distance

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, one which is similar to the IASIG I3DL2 (and DS3D) model. The application choses one of these two models (or can chose to disable distance-dependent attenuation effects model) on a per-context basis.

void DistanceModel ( enum modelName );

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.

Inverse Distance Rolloff Model

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);

     

The REFERENCE_DISTANCE parameter used here is a per-Source attribute that can be set and queried using the REFERENCE_DISTANCE token. REFERENCE_DISTANCE is the distance at which the Listener will experience GAIN (unless the implementation had to clamp effective GAIN to the available dynamic range). ROLLOFF_FACTOR is per-Source parameter the application can use to increase or decrease the range of a source by decreasing or increasing the attenuation, respectively. The default value is 1. The implementation is free to optimize for a ROLLOFF_FACTOR value of 0, which indicates that the application does not wish any distance attenuation on the respective Source.

Inverse Distance Clamped Model

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);