(New page: ==== %ECE301 HW#1<br>%Wei Wang (wang241) ==== ===== %Problem#1 ===== %Regular<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*be...) |
|||
Line 1: | Line 1: | ||
− | ==== %ECE301 HW#1<br>%Wei Wang (wang241) ==== | + | ==== %ECE301 HW#1<br>%Wei Wang (wang241) ==== |
− | ===== %Problem#1 ===== | + | ===== %Problem#1 ===== |
− | %Regular<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2^(1/4)*f*timeH);<br>NoteDflat = sin(2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Regular.wav');<br> | + | %Regular<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2^(1/4)*f*timeH);<br>NoteDflat = sin(2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Regular.wav');<br> |
− | <br> | + | <br> |
− | %Two Times Speed<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112/2;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2^(1/4)*f*timeH);<br>NoteDflat = sin(2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Two_Time_Speed.wav');<br> | + | %Two Times Speed<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112/2;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2^(1/4)*f*timeH);<br>NoteDflat = sin(2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Two_Time_Speed.wav');<br> |
− | <br> | + | <br> |
%X(2t)<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2*2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2*2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2*2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2*2^(1/4)*f*timeH);<br>NoteDflat = sin(2*2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Regular.wav');<br> | %X(2t)<br>f = 2*pi*440;<br>t = 0.0000001;<br>beat = 60/112;<br>H = 2*beat;<br>Q = beat;<br>E = beat/2;<br>DQ = 3*beat/2;<br>timeH = 0:t:H;<br>timeQ = 0:t:Q;<br>timeE = 0:t:E;<br>timeDQ = 0:t:DQ;<br>NoteG = sin(2*2^(-1/6)*f*timeQ);<br>NoteBflat = sin(2*2^(1/12)*f*timeQ);<br>NoteC_DQ = sin(2*2^(1/4)*f*timeDQ);<br>NoteC_H = sin(2*2^(1/4)*f*timeH);<br>NoteDflat = sin(2*2^(1/3)*f*timeE);<br>Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];<br>sound(Melody,1/t);<br>wavwrite(melody, 1/delta, 32, 'Regular.wav');<br> |
Revision as of 19:01, 18 January 2011
%ECE301 HW#1
%Wei Wang (wang241)
%Problem#1
%Regular
f = 2*pi*440;
t = 0.0000001;
beat = 60/112;
H = 2*beat;
Q = beat;
E = beat/2;
DQ = 3*beat/2;
timeH = 0:t:H;
timeQ = 0:t:Q;
timeE = 0:t:E;
timeDQ = 0:t:DQ;
NoteG = sin(2^(-1/6)*f*timeQ);
NoteBflat = sin(2^(1/12)*f*timeQ);
NoteC_DQ = sin(2^(1/4)*f*timeDQ);
NoteC_H = sin(2^(1/4)*f*timeH);
NoteDflat = sin(2^(1/3)*f*timeE);
Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];
sound(Melody,1/t);
wavwrite(melody, 1/delta, 32, 'Regular.wav');
%Two Times Speed
f = 2*pi*440;
t = 0.0000001;
beat = 60/112/2;
H = 2*beat;
Q = beat;
E = beat/2;
DQ = 3*beat/2;
timeH = 0:t:H;
timeQ = 0:t:Q;
timeE = 0:t:E;
timeDQ = 0:t:DQ;
NoteG = sin(2^(-1/6)*f*timeQ);
NoteBflat = sin(2^(1/12)*f*timeQ);
NoteC_DQ = sin(2^(1/4)*f*timeDQ);
NoteC_H = sin(2^(1/4)*f*timeH);
NoteDflat = sin(2^(1/3)*f*timeE);
Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];
sound(Melody,1/t);
wavwrite(melody, 1/delta, 32, 'Two_Time_Speed.wav');
%X(2t)
f = 2*pi*440;
t = 0.0000001;
beat = 60/112;
H = 2*beat;
Q = beat;
E = beat/2;
DQ = 3*beat/2;
timeH = 0:t:H;
timeQ = 0:t:Q;
timeE = 0:t:E;
timeDQ = 0:t:DQ;
NoteG = sin(2*2^(-1/6)*f*timeQ);
NoteBflat = sin(2*2^(1/12)*f*timeQ);
NoteC_DQ = sin(2*2^(1/4)*f*timeDQ);
NoteC_H = sin(2*2^(1/4)*f*timeH);
NoteDflat = sin(2*2^(1/3)*f*timeE);
Melody = [NoteG,NoteBflat,NoteC_DQ,NoteG,NoteBflat,NoteDflat,NoteC_H,NoteG,NoteBflat,NoteC_DQ,NoteBflat,NoteG];
sound(Melody,1/t);
wavwrite(melody, 1/delta, 32, 'Regular.wav');