Born in 1803, Doppler's work explains why trains (and other vehicles) moving towards us sound different from those which are stationary and those moving away from us. The Doppler Effect, proposed in 1842 is explained by the source of the wave (the train) moving towards the observer so that each successive wavepeak is emitted from a postion closer to the observer than the previous wave.
Therefore, each wave takes a little less time to reach the observer than the previous one.This means the wave peaks are sort of bunched together ahead of the vehicle, giving a higher pitch to he sound. The opposite is true behind the train, the wave peaks move further apart giving a lower pitch to the sound.
Sheldon from "The Big Bang Theory" explains the Doppler Effect: