function ssb(fc)
% EC481: SSB AM (S00)
% see p. 243 of Stremler

% Fetch a sound clip
[x fs bits]=wavread('mkmydy.wav');
%[x fs bits]=wavread('s6.wav');
%[x fs bits]=wavread('missedit.wav');
x=x';

% Filter the sound clip to prevent aliasing
[b,a] = butter(10,[0.05 0.8]);
x=filter(b,a,x);

% Make sine and cosine carrier signals
tt=(0:length(x)-1)/fs;
%fc = 300;
c=cos(2*pi*fc*tt);
s=sin(2*pi*fc*tt);

% Phase shifted version of input (use Hilbert transform)
xh=imag(hilbert(x));

% Create the output
y = x.*c - xh.*s;

% Play original sound
disp('Original sound...');
figure(1)
set(1,'Position',[5   312   392   246])
[b,f,t]=specgram(x,[],fs);
imagesc(t,f/1000,abs(b))
axis('xy')
xlabel('time (s)')
ylabel('frequency (kHz)')
title('Input Sound')
sound(x,fs)

disp('Press a key to continue...');
pause

% Play the modified sound
disp('SSB-AM sound')
figure(2)
set(2,'Position',[405   312   392   246])
[b,f,t]=specgram(y,[],fs);
imagesc(t,f/1000,abs(b))
axis('xy')
xlabel('time (s)')
ylabel('frequency (kHz)')
title('SSB-AM Sound')
sound(y,fs)

