Line 81: | Line 81: | ||
%Message: let me on dead man | %Message: let me on dead man | ||
− | |||
− |
Revision as of 11:26, 19 January 2011
%ECE301 HW01 Jiaqi Jiang
del = 0.00005; tempo = 112; bps = tempo/60; beatlength = bps^(-1); fre = 440; %Problem 1 %part 1
h = 0:del:(2*beatlength); q = 0:del:beatlength; e = 0:del:(beatlength/2); dq = 0:del:(1.5*beatlength);
G = fre*(2^(-1/6)); BF = fre*(2^(1/12)); C = fre*(2^(1/4)); DF = fre*(2^(1/3));
qG = sin(2*pi*q*G); qBF = sin(2*pi*q*BF); dqC = sin(2*pi*dq*C); eDF = sin(2*pi*e*DF); hC = sin(2*pi*h*C);
song_normal = [qG,qBF,dqC,qG,qBF,eDF,hC,qG,qBF,dqC,qBF,qG]; sound(song_normal,1/del); pause(5); wavwrite(song_normal,1/del,'normal');
%part 2 fast_beatlength = beatlength /2;
h = 0:del:(2*fast_beatlength); q = 0:del:fast_beatlength; e = 0:del:(fast_beatlength/2); dq = 0:del:(1.5*fast_beatlength);
qG = sin(2*pi*q*G);
qBF = sin(2*pi*q*BF);
dqC = sin(2*pi*dq*C);
eDF = sin(2*pi*e*DF);
hC = sin(2*pi*h*C);
song_fast = [qG,qBF,dqC,qG,qBF,eDF,hC,qG,qBF,dqC,qBF,qG]; sound(song_fast,1/del); pause(5); wavwrite(song_normal,1/del,'fast');
%part 3 h = 0:del:(2*beatlength); q = 0:del:beatlength; e = 0:del:(beatlength/2); dq = 0:del:(1.5*beatlength);
G = 2*fre*(2^(-1/6)); BF = 2*fre*(2^(1/12)); C = 2*fre*(2^(1/4)); DF = 2*fre*(2^(1/3));
qG = sin(2*pi*q*G); qBF = sin(2*pi*q*BF); dqC = sin(2*pi*dq*C); eDF = sin(2*pi*e*DF); hC = sin(2*pi*h*C);
song_high = [qG,qBF,dqC,qG,qBF,eDF,hC,qG,qBF,dqC,qBF,qG]; sound(song_high,1/del); pause(5); wavwrite(song_normal,1/del,'high');
%Problem 2
[input, Fs] = wavread('Beatles.wav'); output = flipud(input); sound(output,Fs); wavwrite(output,Fs,'output');
%Message: let me on dead man