Media:FastFightSong_ECE301Fall2008mboutin.wav
Media:FightSong_ECE301Fall2008mboutin.wav
Media:RescaledFightSong_ECE301Fall2008mboutin.wav
%Tyler Johnson %September 3rd, 2008 %clear memory clear; %clear console clc; %Frequencies for each note %using the frequencies from the homework page, the A note will have a frequency of 440 Hz %some of the frequencies given were way off so I used integer values that I %got from the internet at http://www.phy.mtu.edu/~suits/notefreqs.html x = 264; UC = 2*x %523 B =(15*x)/8 %493 A =415 %415 G =(3*x)/2 %392 F =(4*x)/3 %349 E =311 %311 D =(17*x)/8 %554 MC =x %Length of note delta = .00005; EI = .125; %Eigth Note Q = .25; %Quarter Note H = .5; %Half Note T = .75; %Three Quarters Note W = 1; %Whole Note %Song verticies %Song plays "Hail Hail to old Purdue! All hail to our old gold and black" Notes = [E, F, G, A, B, UC, UC, D, D, D, A, B, B, UC]; Lengths = [H, Q, Q, Q+EI, EI, Q, Q, Q, EI, EI, Q, EI, EI, H+Q]; FightSong = []; for counter = 1:14 t=0:delta:Lengths(counter); d=sin(2*pi*t*Notes(counter)); sound(d,1/delta); FightSong=[FightSong, d]; end %Save a wav file: wavwrite(FightSong,20000,32,'N:\ECE301\Homework 1\FightSong.wav'); pause(2); %Play twice as fast FastFightSong = []; for counter = 1:14 t=0:delta:Lengths(counter)/2; d=sin(2*pi*t*Notes(counter)); sound(d,1/delta); FastFightSong=[FastFightSong, d]; end wavwrite(FastFightSong,20000,16,'N:\ECE301\Homework 1\FastFightSong.wav'); pause(2); %Rescaled RescaledFightSong = []; for counter = 1:14 t=0:delta:Lengths(counter); d=sin(2*pi*(t*2)*Notes(counter)); sound(d,1/delta); RescaledFightSong=[RescaledFightSong, d]; end wavwrite(RescaledFightSong,20000,16,'N:\ECE301\Homework 1\RescaledFightSong.wav');