Line 1: | Line 1: | ||
== Audio files == | == Audio files == | ||
− | [[media:Hw1.1 Ronny Wijaya normal speed.wav|Normal]] | + | *[[media:Hw1.1 Ronny Wijaya normal speed.wav|Normal]] |
− | [[media:Hw1.1 Ronny Wijaya two times faster.wav|Two times faster]] | + | *[[media:Hw1.1 Ronny Wijaya two times faster.wav|Two times faster]] |
− | [[media:Hw1.1 Ronny Wijaya two times frequency.wav|Higher pitch]] | + | *[[media:Hw1.1 Ronny Wijaya two times frequency.wav|Higher pitch]] |
== MATLAB Code == | == MATLAB Code == |
Latest revision as of 08:19, 4 September 2008
Audio files
MATLAB Code
%Ronny Wijaya %rwijaya@purdue.edu %ECE 301 HW 1 delta = 0.00005; %Notes Freq. founded on http://en.wikipedia.org/wiki/Piano_key_frequencies C2 = 523.251; B1 = 493.883; A1s = 466.164; A1 = 440; G1s = 415.305; G1 = 391.995; F1s = 369.994; F1 = 349.228; E1 = 329.628; D1s = 311.127; D1 = 293.665; C1s = 277.183; C1 = 261.626; B0 = 246.942; A0s = 233.082; A0 = 220; G0s = 207.652; %Timing variations' definition quarter=.25; half=.5; threequarters=.75; one=1; onehalf=1.5; two=2; %Notes we are going to play notes=[A0,B0,C1s,D1,E1,F1s,F1s,G1,G1,G1,D1,E1,F1,F1s,F1s,F1s,E1,D1,E1,F1s,F1s,E1,B0,C1s,D1,C1s,B0,E1,A0,A0,B0,C1s,D1,E1,F1s,F1s,F1s,G1,G1,D1,E1,F1s,B0,F1s,D1,B0,A0,D1,F1s,A0,B0,F1s,E1,D1,D1]; %Timing variations we have timing=[one,half,half,threequarters,quarter,half,half,half,quarter,quarter,half,quarter,quarter,onehalf,one,half,half,threequarters,quarter,half,half,half,quarter,quarter,half,quarter,quarter,two,threequarters,quarter,half,half,threequarters,quarter,half,quarter,quarter,half,half,half,half,two,threequarters,quarter,half,half,half,half,half,half,threequarters,quarter,threequarters,quarter,two,two]; for lcv=1:length(notes) t=0:delta:timing(lcv); a=sin(2*pi*t*notes(lcv)); sound(a,1/delta); end for lcv=1:length(notes) t=0:delta:.5*timing(lcv); b=sin(2*pi*t*notes(lcv)); sound(b,1/delta); end for lcv=1:length(notes) t=0:delta:timing(lcv); c=sin(2*2*pi*t*notes(lcv)); sound(c,1/delta); end wavwrite(a,'hw1.1 Ronny Wijaya normal speed.wav'); wavwrite(b,'hw1.1 Ronny Wijaya two times faster.wav'); wavwrite(c,'hw1.1 Ronny Wijaya two times frequency.wav');