# Doppler Extension¶

## Review¶

### Open AL 1.1¶

The Doppler Effect depends on the velocities of source and listener relative to the medium, and the propagation speed of sound in that medium. One can emphasize or de-emphasize the Doppler Effect because physically accurate calculation might not give the desired results. The amount of frequency shift (pitch change) is proportional to the speed of listener and source along their line of sight.
Effects of the medium (air, water) moving with respect to listener and source are ignored.

`SS: AL_SPEED_OF_SOUND` = speed of sound (default value 343.3)
`DF: AL_DOPPLER_FACTOR` = Doppler factor (default 1.0)

`vls`: Listener velocity scalar (scalar, projected on source-to-listener vector)
`vss`: Source velocity scalar (scalar, projected on source-to-listener vector)
`f`: Frequency of sample
`f'`: effective Doppler shifted frequency

3D Mathematical representation of vls and vss:

```Mag(vector) = sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z)
DotProduct(v1, v2) = (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z)
```

`SL` = source to listener vector
`SV` = Source velocity vector
`LV` = Listener velocity vector
```vls = DotProduct(SL, LV) / Mag(SL)
vss = DotProduct(SL, SV) / Mag(SL)
```

Dopper Calculation:

```vss = min(vss, SS/DF)
vls = min(vls, SS/DF)
f' = f * (SS - DF*vls) / (SS - DF*vss)
```