(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
                                                %ECE301 hw1
+
                                              %ECE301 hw1
 
          
 
          
 
%hw part 1
 
%hw part 1
Line 146: Line 146:
 
[[Media:Tune_2.wav|Tune2]]
 
[[Media:Tune_2.wav|Tune2]]
 
[[Media:Tune_3.wav|Tune3]]
 
[[Media:Tune_3.wav|Tune3]]
 +
[[Media:Tune_4.wav|Tune4]]

Latest revision as of 16:54, 21 January 2011

                                              %ECE301 hw1
       

%hw part 1

% (a) Smoke On The Water

%Conversion

%spb=60/112=0.54s

%Declarations

n1=-10;  %steps for each note n2=-7; n3=-5; n4=-10; n5=-7; n6=-4; n7=-5; n8=-10; n9=-7; n10=-5; n11=-7; n12=-10;

delta=0.00005;  %sample rate tq=0:delta:0.25;  %Quarter note timing tdq=0:delta:0.75;  %Dotted quarter note timing te=0:delta:0.125;  %Eighth note th=0:delta:0.5;  %Haft note timing

z1=sin(2*pi*(440*2^(n1/12))*tq);  %note G4 z2=sin(2*pi*(440*2^(n2/12))*tq);  %note B-Flat z3=sin(2*pi*(440*2^(n3/12))*tdq);  %note C z4=sin(2*pi*(440*2^(n4/12))*tq);  %note G z5=sin(2*pi*(440*2^(n5/12))*tq);  %note B-Flat z6=sin(2*pi*(440*2^(n6/12))*te);  %note D-flat z7=sin(2*pi*(440*2^(n7/12))*th);  %note C z8=sin(2*pi*(440*2^(n8/12))*tq);  %note G z9=sin(2*pi*(440*2^(n9/12))*tq);  %note B-Flat z10=sin(2*pi*(440*2^(n10/12))*tdq);  %note C z11=sin(2*pi*(440*2^(n11/12))*tq);  %note B-Flat z12=sin(2*pi*(440*2^(n12/12))*tq);  %note G

z=[z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12];  %combined function

sound(z,1/delta)  %sound!


% (b) Two Times Faster

%Conversion

%spb=60/112=0.54s

%Declarations

n1=-10;  %steps for each note n2=-7; n3=-5; n4=-10; n5=-7; n6=-4; n7=-5; n8=-10; n9=-7; n10=-5; n11=-7; n12=-10;

delta=0.00005;  %sample rate tq=0:delta:0.25/2;  %Quarter note timing tdq=0:delta:0.75/2;  %Dotted quarter note timing te=0:delta:0.125/2;  %Eighth note th=0:delta:0.5/2;  %Haft note timing

z1=sin(2*pi*(440*2^(n1/12))*tq);  %note G4 z2=sin(2*pi*(440*2^(n2/12))*tq);  %note B-Flat z3=sin(2*pi*(440*2^(n3/12))*tdq);  %note C z4=sin(2*pi*(440*2^(n4/12))*tq);  %note G z5=sin(2*pi*(440*2^(n5/12))*tq);  %note B-Flat z6=sin(2*pi*(440*2^(n6/12))*te);  %note D-flat z7=sin(2*pi*(440*2^(n7/12))*th);  %note C z8=sin(2*pi*(440*2^(n8/12))*tq);  %note G z9=sin(2*pi*(440*2^(n9/12))*tq);  %note B-Flat z10=sin(2*pi*(440*2^(n10/12))*tdq);  %note C z11=sin(2*pi*(440*2^(n11/12))*tq);  %note B-Flat z12=sin(2*pi*(440*2^(n12/12))*tq);  %note G

z=[z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12];  %combined function

sound(z,1/delta)  %sound!

% (c) Rescale

%Conversion

%spb=60/112=0.54s

%Declarations

n1=-10;  %steps for each note n2=-7; n3=-5; n4=-10; n5=-7; n6=-4; n7=-5; n8=-10; n9=-7; n10=-5; n11=-7; n12=-10;

delta=0.00005;  %sample rate tq=0:delta:0.25;  %Quarter note timing tdq=0:delta:0.75;  %Dotted quarter note timing te=0:delta:0.125;  %Eighth note th=0:delta:0.5;  %Haft note timing

z1=sin(2*pi*(440*2^(n1/12))*2*tq);  %note G4 z2=sin(2*pi*(440*2^(n2/12))*2*tq);  %note B-Flat z3=sin(2*pi*(440*2^(n3/12))*2*tdq);  %note C z4=sin(2*pi*(440*2^(n4/12))*2*tq);  %note G z5=sin(2*pi*(440*2^(n5/12))*2*tq);  %note B-Flat z6=sin(2*pi*(440*2^(n6/12))*2*te);  %note D-flat z7=sin(2*pi*(440*2^(n7/12))*2*th);  %note C z8=sin(2*pi*(440*2^(n8/12))*2*tq);  %note G z9=sin(2*pi*(440*2^(n9/12))*2*tq);  %note B-Flat z10=sin(2*pi*(440*2^(n10/12))*2*tdq);  %note C z11=sin(2*pi*(440*2^(n11/12))*2*tq);  %note B-Flat z12=sin(2*pi*(440*2^(n12/12))*2*tq);  %note G

z=[z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12];  %combined function

sound(z,1/delta)  %sound!

%hw part 2

[y,fs]=wavread('beatles.wav');  %load the tune and assign it to y with its original frequency z=flipud(y);  %reverse the tune sound(z,fs)  %sound!


Tune1 Tune2 Tune3 Tune4

Alumni Liaison

BSEE 2004, current Ph.D. student researching signal and image processing.

Landis Huffman