(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
To hear the audio files produced click [[here_ECE301Fall2008mboutin]]
  
 +
== Matlab Code ==
  
 +
<pre>
 +
%{
 +
  Homework #1
 +
  Problem 1
 +
  Jeremiah Wise
  
== MY MATLAB CODE ==
+
  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.
 +
%}
  
<pre>
+
%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;
  
matlab code goes here
+
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
 
</pre>
 
</pre>

Latest revision as of 12:54, 4 September 2008

To hear the audio files produced click here_ECE301Fall2008mboutin

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

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett