The Doppler effect can be used to enhance the realism of simulated moving sound sources.
The amount of frequency shift is given by:
where is the frequency of the source at rest, is the frequency perceived by the listener, is the speed of the listener toward the source (zero if not moving), is the speed of the source toward the listener (zero is not moving), and is the sound speed.
We can simulate time-varying source and listener velocities using a time-varying digital delay line with separate read and write pointers. The write pointer corresponds to the source signal and the read pointer corresponds to the listener. In a delay line implementation, the read pointer should follow behind the write pointer. Thus, if the source position is moving toward the listener, the write pointer increment should be changed from 1 to . Likewise, if the listener is moving toward the source, the read pointer increment should be changed from 1 to .
Interpolated reads from a delay line (fractional delay lengths) were previously discussed. Interpolated writes are referred to as de-interpolation.
Because Doppler shift is dependent only on the relative motion of a source and listener and because the de-interpolation process is generally more complicated to implement than interpolation, it is best to change only the read pointer increment when possible.
A continuously varying delay can be implemented with a “growth parameter” such that the read pointer is incremented by at each time step.
Multiple read pointers can simulate multiple moving listeners.
Multiple write pointers can simulate multiple moving sources.
It is not possible to use a single delay line to simulate both multiple moving listeners and multiple moving sources. In this case, the number of necessary delay lines is the lesser of the number of listeners or sources.