Doppler Extension

Version 3 (Nils Peters, 08/19/2011 11:00 pm)

1 1 Nils Peters
h1. Doppler Extension
2 1 Nils Peters
3 1 Nils Peters
h2. Review
4 1 Nils Peters
5 1 Nils Peters
h3. Open AL 1.1
6 1 Nils Peters
7 1 Nils Peters
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.
8 1 Nils Peters
Effects of the medium (air, water) moving with respect to listener and source are ignored.
9 1 Nils Peters
10 2 Nils Peters
@SS: AL_SPEED_OF_SOUND@ = speed of sound (default value 343.3)
11 1 Nils Peters
@DF: AL_DOPPLER_FACTOR@ = Doppler factor (default 1.0) 
12 1 Nils Peters
13 1 Nils Peters
@vls:@ Listener velocity scalar (scalar, projected on source-to-listener vector) 
14 1 Nils Peters
@vss:@ Source velocity scalar (scalar, projected on source-to-listener vector) 
15 3 Nils Peters
@f:@ Frequency of sample @f'@: effective Doppler shifted frequency
16 1 Nils Peters
17 1 Nils Peters
*3D Mathematical representation of vls and vss:*
18 1 Nils Peters
19 2 Nils Peters
<pre>
20 1 Nils Peters
Mag(vector) = sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z) 
21 1 Nils Peters
DotProduct(v1, v2) = (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z) 
22 1 Nils Peters
SL = source to listener vector SV = Source velocity vector
23 1 Nils Peters
LV = Listener velocity vector
24 1 Nils Peters
vls = DotProduct(SL, LV) / Mag(SL) 
25 1 Nils Peters
vss = DotProduct(SL, SV) / Mag(SL)
26 2 Nils Peters
</pre>
27 1 Nils Peters
28 1 Nils Peters
*Dopper Calculation:*
29 2 Nils Peters
<pre>
30 1 Nils Peters
vss = min(vss, SS/DF) 
31 1 Nils Peters
vls = min(vls, SS/DF) 
32 1 Nils Peters
f' = f * (SS - DF*vls) / (SS - DF*vss)
33 2 Nils Peters
</pre>