File:Hail ECE301Fall2008mboutin.wav File:Hail2 ECE301Fall2008mboutin.wav
matlab code
% Sangwan Han % HW1.1 clear; clc; delta=0.00005; %define speed of song ts=20; %define note frequency ue = 660; ud = 594; uc = 528; b = 495; a = 440; g = 396; f = 352; e = 330; d = 297; mc = 264; %note for hail purdue tls= [e f g a g a g a g a ... b a e f g g g a a b a b a b a b uc b e ud uc uc e f g a ... g a g a g a ue uc b a ud ud a a b b b uc ud ... ue uc b a uc b b b e f g a b uc b ud ud ud a b b uc uc] ; %duration tls_dur = [ts ts ts ts ts ts ts*0.75 ts*0.75 ts*0.75 ts*0.75 ... ts ts ts ts ts*2 ts*1.5 ts ts ts ts ts ts ts*0.75 ts*0.75 ts*0.75 ts*0.75 ts ts ts ts ts*2 ts*1.5 ts ts ts ts ... ts ts ts*0.75 ts*0.75 ts*0.75 ts*0.75 ts ts ts ts ts ts*2 ts*0.75 ts*0.75 ts*1.5 ts*0.75 ts*2 ts*0.75 ts*1.5 ... ts ts*0.75 ts*0.75 ts*0.75 ts*0.75 ts*2 ts*2 ts*2 ts*2 ts*2 ts*1.5 ts*1.5 ts*1.5 ts*1.5 ts*1.5 ts*1.5 ts ts ts ts ts ts ts*2]; %normal speed for all= 1:78 %total number of notes t=0:delta:tls_dur(all); song=sin(2*pi*t*tls(all)); sound(song,1/delta); end pause(2) %twice faster speed for all= 1:78 t=0:delta:tls_dur(all)*0.5; %it makes faster *0.5 song=sin(2*pi*t*tls(all)); sound(song,1/delta); end pause(2) %rescale for all= 1:78 t=0:delta:tls_dur(all)*0.5; song=sin(2*2*pi*t*tls(all)); %rescale *2 sound(song,1/delta); end