(One intermediate revision by the same user not shown)
Line 1: Line 1:
Here is a Matlab script reflecting Lecture 1.  The script plays various audio signals. Copy and paste the script into an m-file and play:
+
[[Lecture 1]]
  
load handel; %Loads 2 variables, y and Fs.  y is a signal containing
+
[http://web.ics.purdue.edu/~huffmalm/301SU09/ComplexNumberOverview.pdf Complex Number Handout]
information: a vector of numbers representing an audio clip. Fs is the
+
sampling frequency.
+
 
+
sound(y,Fs); %play the audio file at the appropriate sampling frequency.
+
 
+
input('Press enter to hear the same audio with 1/4 the samples')
+
 
+
downsample = 4; %factor to decrease sampling rate by
+
sound(y(1:downsample:end)*downsample,Fs/downsample); %Plays the same signal with only
+
1/4 of the original "information." Note the degradation in quality
+
 
+
input('Press enter to hear the same audio with 1/100 of the original samples')
+
 
+
downsample = 100; %factor to decrease sampling rate by
+
sound(y(1:downsample:end)*downsample,Fs/downsample); %Plays the same signal with only
+
1/100 of the original "information." Original audio is nearly unrecognizable.
+
 
+
input('Press enter to hear a constant tone note A')
+
 
+
delta = 0.00005; %Sampling period
+
t = 1:delta:3; %a vector representing 3 seconds of time
+
x = sin(2*pi*440*t); %a vector representing the sinusoid tone A
+
 
+
sound(x,1/delta);
+
 
+
input('Press enter to hear a tone note A an octave higher')
+
x = sin(2*pi*880*t); %a vector representing the sinusoid tone A an octave higher
+
 
+
sound(x,1/delta);
+

Latest revision as of 05:44, 18 June 2009

Lecture 1

Complex Number Handout

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009