%Cory Ocker (cocker@purdue.edu)
%9/5/08 HW1
%EE301 MWF 4:30
clear;
clc;
%first i went to http://www.hoerl.com/Music/music1_basic.html and read a
%tutorial on music because I don't know diddly about music notes
%define notes using
%http://www.techlib.com/reference/musical_note_frequencies.htm
A =220;
B =246.94;
C =261.64;
Db =277.20;
D =293.68;
E =329.64;
F =349.24;
Gb =370;
G =392;
%define delta
delta =1/20000;
%define beats (can range from 40 bpm to 200 bpm)
e =.25;
q =.5;
dq =.75;
h =1;
dh =1.5;
w =2;
%timings for notes
lengths =[h,q,q,dq,e,q,q,q,e,e,q,e,e,dh,h,q,q,dq,e,q,q,q,e,e,q,e,e,w,dq,e,...
q,q,dq,e,q,e,e,q,q,q,q,w,dq,e,q,q,q,q,q,q,dq,e,dq,e,w,w];
%notes for song
notes =[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb,Gb,Gb,E,D,E,Gb,Gb,E,B,Db,D,Db,B,E,...
A,A,B,Db,D,E,Gb,Gb,Gb,G,G,D,E,Gb,B,Db,D,B,A,D,Gb,A,B,Gb,E,D,D];
%regular speed
for lcv =1:length(notes)
t =0:delta:lengths(lcv);
wave =sin(2*pi*t*notes(lcv));
sound(wave,1/delta);
end
pause(5)
%double speed
for lcv =1:length(notes)
t =0:delta:1/2*lengths(lcv);
wave =sin(2*pi*t*notes(lcv));
sound(wave,1/delta);
end
pause(5)
%3/4 speed (sounds the best to me after testing)
for lcv =1:length(notes)
t =0:delta:3/4*lengths(lcv);
wave =sin(2*pi*t*notes(lcv));
sound(wave,1/delta);
end
pause(5)
%doubles the frequencies
for lcv =1:length(notes)
t =0:delta:lengths(lcv);
wave =sin(2*2*pi*t*notes(lcv));
sound(wave,1/delta);
end