While waiting on a railway platform for the arrival of a train, you might have observed that the pitch of the whistle when the engine approaches you and when the engine moves away from you are different. The pitch is higher when the engine approaches but is lower when the engine moves away.
Apparent change of frequency observed due to the relative motion of the observer and the source is known as Doppler effect.
Let v be velocity of the sound waves relative to the medium (air), vs velocity of the source and vo velocity of the observer.
The wave originated at a moving source does not affect the speed of the sound. The speed v is the property of the medium. The wave forgets the source as it leaves the source.
Suppose that the source, the observer and the sound waves travel from left to right. First consider the effect of motion of the source.
Length of each wave decreases to
λ′ = (v – vs)/n
Now, consider the effect of motion of the observer.
The number of the waves passing across the observer in one second is
n′ = (v – v0)/λ′