Line 1: | Line 1: | ||
− | [[Category: | + | [[Category:ECE301]] [[Category:Programming]] [[Category:Matlab]] [[Category:lecture notes]] |
− | =Lecture 1, [[ | + | =Lecture 1, [[ECE301]], Summer 2009, Landis Huffman= |
---- | ---- | ||
'''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:''' | ||
Line 37: | Line 37: | ||
sound(x,1/delta); | sound(x,1/delta); | ||
---- | ---- | ||
− | [[ | + | [[ECE301_%28HuffmalmSummer2009%29|Back to ECE301, Summer 2011, Landis Huffman]] |
Latest revision as of 05:30, 11 July 2012
Lecture 1, ECE301, Summer 2009, Landis Huffman
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);