hail_purdue_ECE301Fall2008mboutin.wav

Please ignore the link above and use the link below instead to get access to the file.

Matlab File

%Bavorndej Chanyasak
%ECE 301 hw1.1
%Problem 1a
clear
clc
%According to the scale from Pythagoras, the following notes are G,G,A,B,C
%letting C = 264
Notes = [396, 396, 440, 495, 528];
%This is the duration of each note in the phrase 'Hail Hail to old Purdue'
time = [1.4, 0.4, 0.9, 0.7, 0.9];
song = ones(1);
for i = 1:5 %5 corresponds to the number of notes played
  delta = 0.00005;
  t = 0:delta:time(i) ;
  y = sin(2*pi*Notes(i)*t);
  sound (y, 1/delta); 
  song = [song, y];
end

%Problem 1b (play twice as fast)
for i = 1:5 
  delta = 0.00005;
  t = 0:delta:time(i)*0.5 ;
  y = sin(2*pi*Notes(i)*t);
  sound (y, 1/delta); 
  song = [song, y];
end

%Problem 1c (scaled to y = x(2t)
for i = 1:5 
  delta = 0.00005;
  t = 0:delta:time(i) ;
  y = sin(2*pi*Notes(i)*2*t);
  sound (y, 1/delta); 
  song = [song, y];
end

wavwrite(song, 44100, 32, 'hail_purdue.wav')

%when the time is decreased, the song is faster, and when the frequency
%increases, the tune of the song is higher

Media:hail_purdue_ECE301Fall2008mboutin.wav

Alumni Liaison

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

Dr. Paul Garrett