Revision as of 12:47, 4 September 2008 by Jwise (Talk)

To hear the audio files_ECE301Fall2008mboutin produced click

Matlab Code

%{
  Homework #1
  Problem 1
  Jeremiah Wise

  This Program plays the first portion of the corus "Hail Purdue".
  It first plats at a norlal speed then plays 2 times that speed.
  On the third trial in is played at the original speed in the next
  octave higher.
%}

%Frequencies associated with each note
A   = 220;
Bb  = 233.082;
B   = 246.942;
C   = 261.626;
Db  = 277.183;
D   = 293.665;
Eb  = 311.127;
E   = 329.628;
F   = 349.228;
Gb = 369.994;
G   = 391.995;
Ab  = 415.305;

%First few notes of the chorus
chorus = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb]; 

delta   = 0.0005;

%Part a
endTime = 0.4;
t = [0 : delta : endTime];

for i = 1 : length(chorus)
  note = sin(2 * pi * t * chorus(i));
  sound(note, 1/delta);
end

%Part b
endTime = endTime / 2;
t = 0 : delta : endTime;

for i = 1 : length(chorus)
  note = sin(2 * pi * t * chorus(i));
  sound(note, 1/delta);
end

%Part c
endTime = 0.4;
t = 0 : delta : endTime;

for i = 1 : length(chorus)
  note = sin(4 * pi * t * chorus(i));
  sound(note, 1/delta);
end

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood