% clear; %%ANSWER TO A and B % delta=0.000125%%%%%%%TO PLAY THE SONG AS TWICE AS FAST, double delta value % n=sin(0*(0:delta:0.25)); % c=sin(2*pi*130.81*(0:delta:0.25)); % dp=sin(2*pi*138.59*(0:delta:0.25)); % d=sin(2*pi*146.83*(0:delta:0.25)); % ep=sin(2*pi*155.56*(0:delta:0.25)); % e=sin(2*pi*164.81*(0:delta:0.25)); % f=sin(2*pi*174.61*(0:delta:0.25)); % gp=sin(2*pi*185*(0:delta:0.25)); % g=sin(2*pi*196*(0:delta:0.25)); % ap=sin(2*pi*207.65*(0:delta:0.25)); % a=sin(2*pi*220*(0:delta:0.25)); % bp=sin(2*pi*233.08*(0:delta:0.25)); % b=sin(2*pi*246.94*(0:delta:0.25)); % c1=sin(2*pi*261.63*(0:delta:0.25)); % dp1=sin(2*pi*277.18*(0:delta:0.25)); % d1=sin(2*pi*293.66*(0:delta:0.25)); % ep1=sin(2*pi*311.13*(0:delta:0.25)); % e1=sin(2*pi*329.63*(0:delta:0.25)); % f1=sin(2*pi*349.23*(0:delta:0.25)); % gp1=sin(2*pi*369.99*(0:delta:0.25)); % g1=sin(2*pi*392*(0:delta:0.25)); % ap1=sin(2*pi*415.3*(0:delta:0.25)); % a1=sin(2*pi*440*(0:delta:0.25)); % bp1=sin(2*pi*466.16*(0:delta:0.25)); % b1=sin(2*pi*493.88*(0:delta:0.25));
%ANSWER TO C %%%RESCALING ACCORDING TO THE TRANSFORMATION Y=X(2T) CAUSED INCREASED TONE %%%OF MELODY BUT DID NOT AFFECT THE SPEED OF THE SONG. delta=0.000125 n=sin(4*0*(0:delta:0.25)); c=sin(4*pi*130.81*(0:delta:0.25)); dp=sin(4*pi*138.59*(0:delta:0.25)); d=sin(4*pi*146.83*(0:delta:0.25)); ep=sin(4*pi*155.56*(0:delta:0.25)); e=sin(4*pi*164.81*(0:delta:0.25)); f=sin(4*pi*174.61*(0:delta:0.25)); gp=sin(4*pi*185*(0:delta:0.25)); g=sin(4*pi*196*(0:delta:0.25)); ap=sin(4*pi*207.65*(0:delta:0.25)); a=sin(4*pi*220*(0:delta:0.25)); bp=sin(4*pi*233.08*(0:delta:0.25)); b=sin(4*pi*246.94*(0:delta:0.25)); c1=sin(4*pi*261.63*(0:delta:0.25)); dp1=sin(4*pi*277.18*(0:delta:0.25)); d1=sin(4*pi*293.66*(0:delta:0.25)); ep1=sin(4*pi*311.13*(0:delta:0.25)); e1=sin(4*pi*329.63*(0:delta:0.25)); f1=sin(4*pi*349.23*(0:delta:0.25)); gp1=sin(4*pi*369.99*(0:delta:0.25)); g1=sin(4*pi*392*(0:delta:0.25)); ap1=sin(4*pi*415.3*(0:delta:0.25)); a1=sin(4*pi*440*(0:delta:0.25)); bp1=sin(4*pi*466.16*(0:delta:0.25)); b1=sin(4*pi*493.88*(0:delta:0.25));
line1=[ep,ep,f,f,g,g,ap,ap,g,g,ap,ap,g,ap,g,ap]; line2=[bp,bp,ap,ap,ep,ep,f,f,g,g,g,g,g,g,n,n,g,g,ap,ap]; line3=[a,a,bp,bp,a,a,bp,bp,a,bp,a,bp,c1,c1,bp,bp]; line4=[ep,ep,dp1,dp1,c1,c1,c1,c1,c1,c1,n,n,ep,ep,f,f,g,g,ap,ap]; line5=[g,g,ap,ap,g,ap,g,ap,ep1,ep1,c1,c1,bp,bp,ap,ap]; line6=[dp1,dp1,dp1,dp1,dp1,dp1,ap,ap,bp,bp,bp,bp,b,b,b,b,c1,c1,c1,dp1]; line7=[ep1,c1,bp,ap,c1,c1,c1,c1,bp,bp,bp,bp,bp,bp,bp,bp,bp,bp,n,n]; song=[line1,line2,line3,line4,line5,line6,line7];
wavwrite(song,'song.wav');