Revision as of 22:41, 4 September 2008 by Sje (Talk)

wave Files

Matlab Code

%Sang Mo Je(00219-76434)
%ECE 301, Homework 1.1

clear;
clc;
delta=0.00005;

A=220; %la
Bb=233.0819; %ti flat
B=246.9417; %ti
C=261.6256; %do
Db=277.1826; %re flat
D=293.6648; %re
Eb=311.1270; %mi flat
E=329.6276; %mi
F=349.2282; %fa
Gb=369.9944; %so flat
G=391.9954; %so
Aub=415.3047; % upper la flat
Au=440; % uppper la
Bub=466.1638; % upper ti flat
Bu=493.8833; % upper ti
Cu=523.2511; % upper do 
Dub=554.3653; % upper re flat
Du=587.3295; % upper re
Eub=622.2540; % upper mi flat
REST=0; 

P=0.43; %140bpm, 60/140=0.43
PP=P*1.5;
DP=P*2;
TP=P*3;
H=P/2;

NOTE1=[Eb,F,G,Aub,G,Aub,G,Aub,G,Aub,Bub,Aub,Eb,F,G,REST,G,Aub];
LENGTH1=[P,P,P,P,P,P,H,H,H,H,P,P,P,P,TP,P,P,P];
NOTE2=[Au,Bub,Au,Bub,Au,Bub,Aub,Bub,Cu,Bub,Eb,Dub,Cu,REST,Eb,F,G,Aub];
LENGTH2=[P,P,P,P,H,H,H,H,P,P,P,P,TP,P,P,P,P,P];
NOTE3=[G,Aub,G,Aub,G,Aub,Eub,Cu,Bub,Aub,Dub,Aub,Bub,Bub,Bu,Bub,Cu,Dub];
LENGTH3=[P,P,H,H,H,H,P,P,P,P,TP,P,PP,H,PP,H,PP,H];
NOTE4=[Eub,Cu,Bub,Aub,Cu,Bub,Bub,REST,Eb,F,G,Aub,Bub,Cu,Cu];
LENGTH4=[H,H,H,H,DP,DP,TP,P,DP,P,P,PP,H,P,P];
NOTE5=[Dub,Dub,Dub,Aub,Bub,Bu,Cu,REST,Cu,Cu,Bub,Aub,Bub,Cu,Cu,Bub,F,G];
LENGTH5=[P,H,H,P,H,H,TP,P,DP,P,P,PP,H,P,P,P,H,H];
NOTE6=[Aub,G,F,Bub,REST,Eb,Eb,F,G,Aub,Bub,Cu,Cu,Cu,Dub,Dub,Aub,Bub];
LENGTH6=[P,H,H,TP,P,PP,H,P,P,PP,H,P,H,H,P,P,P,P];
NOTE7=[Cu,REST,F,G,Aub,F,Eb,Aub,Cu,Eb,F,Cu,Bub,Aub,Aub,REST];
LENGTH7=[TP,P,PP,H,P,P,P,P,P,P,PP,H,PP,H,TP,P];

for n=1:18
t=0:delta:LENGTH1(n); %to make 2times faster, LENGTH1*0.5
x=sin(4*pi*t*NOTE1(n));
sound(x,1/delta);
end

for n=1:18
t=0:delta:LENGTH2(n); %to make 2times faster, LENGTH2*0.5
x=sin(4*pi*t*NOTE2(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end

for n=1:18
t=0:delta:LENGTH3(n); %to make 2times faster, LENGTH3*0.5
x=sin(4*pi*t*NOTE3(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end

for n=1:15
t=0:delta:LENGTH4(n); %to make 2times faster, LENGTH4*0.5
x=sin(4*pi*t*NOTE4(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end

for n=1:18
t=0:delta:LENGTH5(n); %to make 2times faster, LENGTH5*0.5
x=sin(4*pi*t*NOTE5(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end

for n=1:18
t=0:delta:LENGTH6(n); %to make 2times faster, LENGTH6*0.5
x=sin(4*pi*t*NOTE6(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end


for n=1:16
t=0:delta:LENGTH7(n); %to make 2times faster, LENGTH7*0.5
x=sin(4*pi*t*NOTE7(n)); %to make t to 2t, change 2 to 4
sound(x,1/delta);
end



Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn