(MATLAB Code)
(Sound File)
Line 1: Line 1:
 
== Sound File ==
 
== Sound File ==
*[[Media:HW1.1_ECE301Fall2008mboutin|Hail Purdue]]  at normal speed using
+
*[[Media:HW1.1_ECE301Fall2008mboutin.wav|Hail Purdue]]  at normal speed using
*[[Media:HW1.1_ECE301Fall2008mboutin|Hail Purdue]]  at double speed
+
*[[Media:HW1.1_ECE301Fall2008mboutin.wav|Hail Purdue]]  at double speed
*[[Media:HW1.1_ECE301Fall2008mboutin|Hail Purdue]]  at twice the frequency
+
*[[Media:HW1.1_ECE301Fall2008mboutin.wav|Hail Purdue]]  at twice the frequency
  
 
== MATLAB Code ==
 
== MATLAB Code ==

Revision as of 07:54, 1 September 2008

Sound File

MATLAB Code

% Scott Erdbruegger
% Homework 1.1
% Note this Code takes a while to run due to the number of calculations(5000*28)
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 aproixamently .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

Meet a recent graduate heading to Sweden for a Postdoctorate.

Christine Berkesch