# Distance Encoding ## Attenuation

Version 2.2 comes with four different encoding options.

### Standard

This encoding is based on: Martin Neukom - Ambisonics User Defined Opcodes for Csound. The radius of the unit circle around the coordinate origin can be defined (default 0.1). Therefore the distance is being scaled according to this radius:

scaledDistance = distance * (1 / unitCircleRadius)

The following gains are applied:

• W-Channel: atan(scaledDistance * PI / 2) / (scaledDistance * PI / 2)
• All other Channels: (1 - e^-scaledDistance) * atan(scaledDistance * PI / 2) / (scaledDistance * PI / 2)

This method is based on the formulas above, extended with two user-definable variables (advancedFactor, advancedExponent) that affect the shape of the curve outside the unit circle:

All channels are multiplied with the result of the following expression: pow(1 - advancedFactor * (distance - unitCircle), advancedExponent)

### Exponential and Inverse Proportional

These algorithms are approximations of the distance encoding algorithms used by the ICST MaxMSP Ambisonics Externals. The curve is separated into two sections, inside/outside the unit circle.

#### Inside

Same formula for both algorithms:

• W-Channel: 1
• All other channels: (pow((distance * (1.0 / unitCircle)), -centerCurve) * (1 - dbUnit)) + dbUnit

#### Outside

For all channels:

• Exponential: pow(10.0, (distance - unitCircle) * -dbUnit / 20.0)
• Inverse Proportional: pow(distance + (1 - unitCircle), -distanceAttenuation)

## Air Absorption

Currently there is one possibility implemented, to simulate simplified air absorption. The basic idea is, to apply a first order low pass filter with a cut-off frequency that depends on the distance of the source from the center. The "intensity" parameter allows to adjust the impact of distance change on the filter. The formula used is as follows:

• f_cutoff = limit(10.0, sampleRate / 2.0, 20000 * exp(-0.1 * distance * intensity))

Updated