% M-file for loading, playing and plotting various signals
% 
echo on
load firstsignals;
whos

pause % hit any key to continue

% Sine220
pause; % for plotting sine220
plot(sine220(1:500))
zoom xon;
pause; % for listening to sine220
soundsc(sine220)

% Sine440
pause; % for plotting sine440
figure;
plot(sine440(1:500))
zoom xon;
pause; % for listening to sine440
soundsc(sine440)

% Sine880
pause; % for plotting sine880
figure;
plot(sine880(1:500))
zoom xon;
pause; % for listening to sine880
soundsc(sine880)

% Triangular waveform 
pause; % for plotting triang220
figure;
plot(triang220(1:500))
zoom xon;
pause; % for listening  
soundsc(triang220)

% Square waveform
pause; % for plotting square220
figure;
plot(square220(1:500))
zoom xon;
axis([1 500 -1 1]);
pause; % for listening  
soundsc(square220)


% DC
pause; % for plotting dc
figure;
plot(dc)


% An audio signal
pause; % this is a demonstration 
figure;
plot(this)
zoom xon;
pause; % listening
soundsc(this,11025);

% E-A-R-T-H
pause; % E-A-R-T-H
figure;
plot(earth)
zoom xon;
pause; % listening
soundsc(earth,11025);

% A noise waveform
pause; % Gaussian noise
figure;
plot(noise)
zoom xon;
pause; % listening
soundsc(noise,11025);

% A voice corrupted by noise
pause; % E-A-R-T-H + Gaussian noise
figure;
plot(earthnoise)
zoom xon;
pause; % listening
soundsc(earthnoise,11025);

% Waveform comparison
figure;
zoom xon
subplot(2,1,1)
plot(earth(1000:1500))
subplot(2,1,2)
plot(earthnoise(1000:1500));


% Soft-to-loud 
pause; % soft to loud
figure;
plot(softloud)
zoom xon;
pause; % listening
soundsc(softloud,11025);

% Low-to-high 
pause; % low to high pitch
figure;
plot(lowtohighpitch)
zoom xon;
pause; % listening
soundsc(lowtohighpitch,11025);



