(Sound Files)
(MATLAB Code)
Line 8: Line 8:
 
% Scott Erdbruegger
 
% Scott Erdbruegger
 
% Homework 1.1
 
% Homework 1.1
% Note this Code takes a while to run due to the number of calculations(5000*28)
+
% Note this Code takes a while to run due to the number of calculations(5000*28) but can be done through software remote
 
format compact
 
format compact
 
clc
 
clc
Line 16: Line 16:
 
C=261.626;A=5*C/3;B=15*C/8;D=9*C/8;E=5*C/4;F=4*C/3;G=3*C/2;
 
C=261.626;A=5*C/3;B=15*C/8;D=9*C/8;E=5*C/4;F=4*C/3;G=3*C/2;
 
notes=[E,F,G,A,B,C*2,C*2,D*2,D*2,D*2,A,B,B,C*2,C*2,C*2,B,A,B,C*2,C*2,B,F,G,A,G,F,B];
 
notes=[E,F,G,A,B,C*2,C*2,D*2,D*2,D*2,A,B,B,C*2,C*2,C*2,B,A,B,C*2,C*2,B,F,G,A,G,F,B];
Lengthofnote=.25;%Note Each syllable has one note aproixamently .25 of a second long
+
Lengthofnote=.25;%Note Each syllable has one note aproximently .25 of a second long
 
numnotes=28;
 
numnotes=28;
 
t=0;
 
t=0;

Revision as of 18:55, 3 September 2008

Sound Files

MATLAB Code

% Scott Erdbruegger
% Homework 1.1
% Note this Code takes a while to run due to the number of calculations(5000*28) but can be done through software remote
format compact
clc
clear
delta = .00005;
i=1;
C=261.626;A=5*C/3;B=15*C/8;D=9*C/8;E=5*C/4;F=4*C/3;G=3*C/2;
notes=[E,F,G,A,B,C*2,C*2,D*2,D*2,D*2,A,B,B,C*2,C*2,C*2,B,A,B,C*2,C*2,B,F,G,A,G,F,B];
Lengthofnote=.25;%Note Each syllable has one note aproximently .25 of a second long
numnotes=28;
t=0;
while t<numnotes*Lengthofnote-.05
    if(mod(i,5000)==0)
        x(i)=0;z(i)=0;t
    else
         x(i)=sin(2*pi*notes(ceil(i/5000))*t);%normal
         z(i)=sin(2*pi*2*notes(ceil(i/5000))*t);%twice frequency
    end
    t=t+delta;i=i+1;
end
t=0;i=1;
while t<numnotes*Lengthofnote/2-.05
    if(mod(i,2500/2)==0)
        y(i)=0;t
    else        
        y(i)=sin(2*pi*notes(ceil(i/2500))*t);%twice as fast
    end
    t=t+delta;i=i+1;
end
wavwrite(x,'hw1normal.wav');
wavwrite(y,'hw1faster.wav');
wavwrite(z,'hw1frequency.wav');

Alumni Liaison

Prof. Math. Ohio State and Associate Dean
Outstanding Alumnus Purdue Math 2008

Jeff McNeal