According to the Doppler effect, the pitch of the source when it is approaching towards the stationary observer changes due to relative motion between the listener and the source as by relation: \(f'=\frac v{v-v_s}f\), where v is the velocity of sound and vs is the velocity of moving source. When the train is approaching, there is a relative motion between the stationary listener outside the train and the train. Hence, the pitch increases for the stationary listener outside the train. That's why; the whistle of an approaching train is shriller.