%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GENERATE A SINE WAVE AT 440 Hz for 5 seconds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

f=440;                               % frequency of the signal (in Hz)
fs = 44100;                          % sampling frequency (in Hz)
nsec = 5;                            % number of seconds
t = 0 : 1/fs : nsec;                 % the time of each sample
y = sin(2*pi*f*t);                   % generate the signal
sound(y, fs)                         % play this on the speakers
audiowrite('note_440Hz.wav', y, fs); % save it to a WAV file

