%Vishal Ramani

%HW 1 Problem 4

%ECE 301


clc


A=440; %Given frequency value

Ahigh=A*2 %one octive higher in value

C=A*3/5 %given from table 1

Chigh=C*2

E=C*5/4;%relates E note to other notes

Ehigh=E*2

G=C*3/2

Ghigh=G*2

B=15*C/8;

Bhigh=B*2


%Low Notes

Glow=G/2;

Elow=E/2;

Alow=A/2

Blow=B/2;

Asharplow=233; %Given value


DEL = 0.0001;


t8 = 0:DEL:.5/2; %an eigth note at 120 beats/min

t4 =0:DEL:1/2;

t2 = 0:DEL:2/2;

t16 = 0:DEL:.25/2;

tdot8 = 0:DEL:.5*1.5/2;

y1 = sin(2*pi*Ehigh*t16); %a high E related to middle C through table 1 then doubled to for 1 higher octive.

%E

sound(y1,1/DEL);%plays a E note in the 5th octive

y1 = sin(2*pi*Ehigh*t8);

%E

sound(y1,1/DEL);

y1 = sin(2*pi*Ehigh*t16);

%E

sound(y1,1/DEL);

y1 = sin(2*pi*0*t16);

%rest 16

sound(y1,1/DEL);

y1 = sin(2*pi*Chigh*t16);

%C

sound(y1,1/DEL);

y1 = sin(2*pi*Ehigh*t8);

%E

sound(y1,1/DEL);

y1 = sin(2*pi*Ghigh*t4);

%G

sound(y1,1/DEL);

y1 = sin(2*pi*0*t4);

%rest4

sound(y1,1/DEL);

y1 = sin(2*pi*Chigh*tdot8);

%C sound(y1,1/DEL);

y1 = sin(2*pi*G*t16);

%G

sound(y1,1/DEL);

y1 = sin(2*pi*0*t8); %rest sound

%rest 8

sound(y1,1/DEL);

y1 = sin(2*pi*E*t8);

%E

sound(y1,1/DEL);

y1 = sin(2*pi*0*t16);

%rest 16

sound(y1,1/DEL);

y1 = sin(2*pi*A*t8);

%A

sound(y1,1/DEL);

y1 = sin(2*pi*B*t16);

%B

sound(y1,1/DEL);

y1 = sin(2*pi*0*t16);

%rest 16

sound(y1,1/DEL);

y1 = sin(2*pi*Asharplow*t16);

%LAsharp

sound(y1,1/DEL);

y1 = sin(2*pi*A*t8);

%A 8

sound(y1,1/DEL);

Alumni Liaison

Have a piece of advice for Purdue students? Share it through Rhea!

Alumni Liaison