% PlaySinusoid - play a sinusoidal signal with the specified parameters
%

%% Parameters of sinusoid
A = 1;
f = 1*440;
phi = 0;

dur = 1; % duration
fs = 44100; %  sampling rate, should be one of 8192, 11025, 22050, or 44100

%% Compute sinusoid
tt = (0 : 1/fs : dur);
xx = A*cos(2*pi*f*tt + phi);

%% play it through the speaker
fprintf('Playing sinusoid:\n\tA   = %d\n\tf   = %d Hz\n\tphi = %f *pi\n\n',...
    A, f, phi/pi)

sound( xx, fs );
