(New page: 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: load handel; %Loads 2 variables, y and Fs. y is ...)
 
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:
+
'''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:'''
 +
 
  
 
load handel; %Loads 2 variables, y and Fs.  y is a signal containing  
 
load handel; %Loads 2 variables, y and Fs.  y is a signal containing  

Revision as of 12:10, 15 June 2009

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:


load handel; %Loads 2 variables, y and Fs. y is a signal containing 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);

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics