%ECE301 HW#1
%Wei Wang (wang241)

 %Problem#1

%Regular
f = 2*pi*440;
t = 0.0001;
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/t, 32, 'Regular.wav');


%Two Times Speed
f = 2*pi*440;
t = 0.0001;
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/t, 32, 'Two_Time_Speed.wav');


%High Pinch
f = 2*pi*440;
t = 0.0001;
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/t, 32, 'High_Pinch.wav');


https://www.projectrhea.org/rhea/images/7/72/Regular.wav

https://www.projectrhea.org/rhea/images/2/23/Two_Time_Speed.wav

https://www.projectrhea.org/rhea/images/e/e6/High_Pinch.wav


 %Problem#2

[Melody, F] = wavread('Beatles.wav');
Melody_Reverse = flipud(Melody);
sound(Melody_Reverse,F);
wavwrite(Melody_Reverse,F,'Beatles_Reverse');

https://www.projectrhea.org/rhea/images/6/6b/Beatles_Reverse.wav


%The forward phrase is ' Number  Nine'.

%I can't tell what the reverse is saying. It's like 'ZXXXXX Dimon'.

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett