function [Yfr] = DOPPLER_SHIFT_RECEDING(fo,vs)

% Calculates the perceived frequency of a sound emitted from a source travelling directly
% towards a stationary receiver. The pitch will not fluctuate because the object
% travels directly towards a stationary receiver at a constant speed. The approaching frequency will be higher then the true frequency, and the
% receding frequency will be lower than the true frequency.

%==========================================================================

% Input Data
c  = 344;   % m/s
% fo = ();  % Hz - emitted frequency
% vs = ();  % m/s
fs = 44100; % sample rate
time = 2;   % duration of the new observed frequency in seconds

%--------------------------------------------------------------------------

% Output Data

fr = [c/(c+vs)]*fo; % calculates receding frequency
Yfr = sin(linspace(0, time*fr*2*pi, round(time*fs)));

%--------------------------------------------------------------------------

sound(Yfr, fs);  % Listen to observed receding frequency

audiowrite('receding_pitch_shift.wav', Yfr,fs);

end %==========================================================================

