As a sound comes towards you (say an ambulance) the sound waves arrive squashed (higher pitch) and as it goes away the sound waves are stretched (lower pitch).