If you've ever been waiting at a railroad crossing and listened to the train whistle, you've probably noticed that the pitch of the whistle changes as it moves relative to your position. Similarly, the pitch of a siren change as it approaches and then passes you on the road.
Calculating the Doppler EffectConsider a situation where the motion is oriented in a line between the listener L and the source S, with the direction from the listener to the source as the positive direction. The velocities vL and vS are the velocities of the listener and source relative to the wave medium (air in this case, which is considered at rest). The speed of the sound wave, v, is always considered positive.
Applying these motions, and skipping all the messy derivations, we get the frequency heard by the listener (fL) in terms of the frequency of the source (fS):
fL = [(v + vL)/(v + vS)] fSIf the listener is at rest, then vL = 0.
If the source is at rest, then vS = 0.
This means that if neither the source nor the listener are moving, then fL = fS, which is exactly what one would expect.
If the listener is moving toward the source, then vL > 0, though if it's moving away from the source then vL < 0.
Alternately, if the source is moving toward the listener the motion is in the negative direction, so vS < 0, but if the source is moving away from the listener then vS > 0.