m
Line 1: Line 1:
 
%Takashi Nakachi
 
%Takashi Nakachi
 +
 
%ECE 301 HW1
 
%ECE 301 HW1
 +
 
%the notes needed for the song are E G C G, 1 octave down E 1 octave down A one
 
%the notes needed for the song are E G C G, 1 octave down E 1 octave down A one
 +
 
%octave down B one octave down A# one octave down
 
%octave down B one octave down A# one octave down
 +
 +
 +
  
 
%a4 = fundamental =  
 
%a4 = fundamental =  
 +
 
fundamental = 440;
 
fundamental = 440;
 +
 
c4 = (3*fundamental)/5;
 
c4 = (3*fundamental)/5;
 +
 
e4 = (5*c4)/4;
 
e4 = (5*c4)/4;
 +
 
g4 = (3*c4)/2;
 
g4 = (3*c4)/2;
 +
 
e3 = (5*c4)/4;
 
e3 = (5*c4)/4;
 +
 
g3 = (3*c4)/4;
 
g3 = (3*c4)/4;
 +
 
a3 = fundamental/2;
 
a3 = fundamental/2;
 +
 
b3 = (15*c4)/16;
 
b3 = (15*c4)/16;
 +
 
asharp3 = fundamental*(2^(1/12))^(-11);
 
asharp3 = fundamental*(2^(1/12))^(-11);
 +
 +
 +
  
  
 
del = 0.0001;
 
del = 0.0001;
 +
 
%4/4 time 5 bars long at 60bpm
 
%4/4 time 5 bars long at 60bpm
 +
 
%1/4
 
%1/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*e4*t);
 
y = sin(2*pi*e4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%2/4
 
%2/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*e4*t);
 
y = sin(2*pi*e4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%3/4
 
%3/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*e4*t);
 
y = sin(2*pi*e4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%4/4
 
%4/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*g4*t);
 
y = sin(2*pi*g4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%1/4
 
%1/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*c4*t);
 
y = sin(2*pi*c4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%2/4
 
%2/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*e4*t);
 
y = sin(2*pi*e4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%3/4
 
%3/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*g4*t);
 
y = sin(2*pi*g4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%4/4
 
%4/4
 +
 
t = 0:del:.25;
 
t = 0:del:.25;
 +
 
y = sin(2*pi*c4*t);
 
y = sin(2*pi*c4*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%2/4
 
%2/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*g3*t);
 
y = sin(2*pi*g3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%4/4
 
%4/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*e3*t);
 
y = sin(2*pi*e3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%2/4
 
%2/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*a3*t);
 
y = sin(2*pi*a3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%4/4
 
%4/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*b3*t);
 
y = sin(2*pi*b3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%2/4
 
%2/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*asharp3*t);
 
y = sin(2*pi*asharp3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 
%4/4
 
%4/4
 +
 
t = 0:del:.5;
 
t = 0:del:.5;
 +
 
y = sin(2*pi*a3*t);
 
y = sin(2*pi*a3*t);
 +
 
sound(y,1/del);
 
sound(y,1/del);
 +
 +
  
 
--[[User:Tnakachi|Tnakachi]] 19:09, 23 June 2009 (UTC)
 
--[[User:Tnakachi|Tnakachi]] 19:09, 23 June 2009 (UTC)

Revision as of 14:10, 23 June 2009

%Takashi Nakachi

%ECE 301 HW1

%the notes needed for the song are E G C G, 1 octave down E 1 octave down A one

%octave down B one octave down A# one octave down



%a4 = fundamental =

fundamental = 440;

c4 = (3*fundamental)/5;

e4 = (5*c4)/4;

g4 = (3*c4)/2;

e3 = (5*c4)/4;

g3 = (3*c4)/4;

a3 = fundamental/2;

b3 = (15*c4)/16;

asharp3 = fundamental*(2^(1/12))^(-11);



del = 0.0001;

%4/4 time 5 bars long at 60bpm

%1/4

t = 0:del:.25;

y = sin(2*pi*e4*t);

sound(y,1/del);

%2/4

t = 0:del:.25;

y = sin(2*pi*e4*t);

sound(y,1/del);

%3/4

t = 0:del:.25;

y = sin(2*pi*e4*t);

sound(y,1/del);

%4/4

t = 0:del:.25;

y = sin(2*pi*g4*t);

sound(y,1/del);

%1/4

t = 0:del:.25;

y = sin(2*pi*c4*t);

sound(y,1/del);

%2/4

t = 0:del:.25;

y = sin(2*pi*e4*t);

sound(y,1/del);

%3/4

t = 0:del:.25;

y = sin(2*pi*g4*t);

sound(y,1/del);

%4/4

t = 0:del:.25;

y = sin(2*pi*c4*t);

sound(y,1/del);

%2/4

t = 0:del:.5;

y = sin(2*pi*g3*t);

sound(y,1/del);

%4/4

t = 0:del:.5;

y = sin(2*pi*e3*t);

sound(y,1/del);

%2/4

t = 0:del:.5;

y = sin(2*pi*a3*t);

sound(y,1/del);

%4/4

t = 0:del:.5;

y = sin(2*pi*b3*t);

sound(y,1/del);

%2/4

t = 0:del:.5;

y = sin(2*pi*asharp3*t);

sound(y,1/del);

%4/4

t = 0:del:.5;

y = sin(2*pi*a3*t);

sound(y,1/del);


--Tnakachi 19:09, 23 June 2009 (UTC)

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett