Yes, the frequency of a sound wave can be affected if the source of the sound wave is moving relative to the observer. This phenomenon is known as the Doppler effect.
The Doppler effect describes the change in frequency (and perceived pitch) of a wave when there is relative motion between the source of the wave and the observer. The effect can be observed with any type of wave, including sound waves.
When a sound source is moving towards an observer, the relative motion causes the sound waves to be compressed, resulting in a higher frequency and a perceived increase in pitch. This is known as a "Doppler shift to higher frequency" or "blue shift."
Conversely, when a sound source is moving away from an observer, the sound waves are stretched, leading to a lower frequency and a perceived decrease in pitch. This is called a "Doppler shift to lower frequency" or "red shift."
The Doppler effect is commonly experienced in everyday situations, such as the change in pitch of an approaching or receding vehicle siren. It also has important applications in various fields, including astronomy, where it is used to determine the motion of celestial objects based on their observed frequency shifts.