Tyler Mattmuller HW1 Problem 4 A=440; %Given value HA=A*2 %one octive above C=A*3/5 %from table 1 HC=C*2 E=C*5/4;%relate to other notes HE=E*2 G=C*3/2 HG=G*2 B=15*C/8; BE=B*2 LG=G/2; LE=E/2; LA=A/2 LB=B/2; LAsharp=233; %Given
DELTA = 0.0001; t8 = 0:DELTA:.5/2; %an eigth note at 120 beats per minute t4 =0:DELTA:1/2; t2 = 0:DELTA:2/2; t16 = 0:DELTA:.25/2; tdot8 = 0:DELTA:.5*1.5/2; y1 = sin(2*pi*HE*t16); %a high E related to middle C through table 1 then doubled to for 1 higher octive. this is held for the same duration as a 16th note %E sound(y1,1/DELTA);%plays a E note in the 5th octive y1 = sin(2*pi*HE*t8); %E sound(y1,1/DELTA); y1 = sin(2*pi*HE*t16); %E sound(y1,1/DELTA); y1 = sin(2*pi*0*t16); %rest 16 sound(y1,1/DELTA); y1 = sin(2*pi*HC*t16); %C sound(y1,1/DELTA); y1 = sin(2*pi*HE*t8); %E sound(y1,1/DELTA); y1 = sin(2*pi*HG*t4); %G sound(y1,1/DELTA); y1 = sin(2*pi*0*t4); %rest4 sound(y1,1/DELTA); y1 = sin(2*pi*HC*tdot8); %C sound(y1,1/DELTA); y1 = sin(2*pi*G*t16); %G sound(y1,1/DELTA); y1 = sin(2*pi*0*t8); %when sin(0) y1=0 and no sound will play for a rest %rest 8 sound(y1,1/DELTA); y1 = sin(2*pi*E*t8); %E sound(y1,1/DELTA); y1 = sin(2*pi*0*t16); %rest 16 sound(y1,1/DELTA); y1 = sin(2*pi*A*t8); %A sound(y1,1/DELTA); y1 = sin(2*pi*B*t16); %B sound(y1,1/DELTA); y1 = sin(2*pi*0*t16); %rest 16 sound(y1,1/DELTA); y1 = sin(2*pi*LAsharp*t16); %LAsharp sound(y1,1/DELTA); y1 = sin(2*pi*A*t8); %A 8 sound(y1,1/DELTA);