(New page: %%Mario Theme by Ryne Rayburn clear all clc A=440; %%Given Value - Freq. of A C=A*3/5; %%From Given Table - Middle C B=15*C/8; G=3*C/2; F=4*C/3; E=5*C/4; D=9*C/8; Cup=2*C; Clow=C/2; Glow=...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
%%Mario Theme by Ryne Rayburn | %%Mario Theme by Ryne Rayburn | ||
+ | |||
clear all | clear all | ||
+ | |||
clc | clc | ||
A=440; %%Given Value - Freq. of A | A=440; %%Given Value - Freq. of A | ||
+ | |||
C=A*3/5; %%From Given Table - Middle C | C=A*3/5; %%From Given Table - Middle C | ||
+ | |||
B=15*C/8; | B=15*C/8; | ||
+ | |||
G=3*C/2; | G=3*C/2; | ||
+ | |||
F=4*C/3; | F=4*C/3; | ||
+ | |||
E=5*C/4; | E=5*C/4; | ||
+ | |||
D=9*C/8; | D=9*C/8; | ||
+ | |||
Cup=2*C; | Cup=2*C; | ||
+ | |||
Clow=C/2; | Clow=C/2; | ||
+ | |||
Glow=G/2; | Glow=G/2; | ||
+ | |||
Elow=E/2; | Elow=E/2; | ||
+ | |||
Alow=A/2; | Alow=A/2; | ||
+ | |||
Blow=B/2; | Blow=B/2; | ||
+ | |||
AlowSHARP=233.08; | AlowSHARP=233.08; | ||
DELTA=.0001; | DELTA=.0001; | ||
+ | |||
t=0:DELTA:1; %%One Second of playing | t=0:DELTA:1; %%One Second of playing | ||
+ | |||
t2=0:DELTA:.5; %%Half Note | t2=0:DELTA:.5; %%Half Note | ||
+ | |||
t4=0:DELTA:.25; %%Quarter Note | t4=0:DELTA:.25; %%Quarter Note | ||
+ | |||
t8=0:DELTA:.125; %%Eigth Note | t8=0:DELTA:.125; %%Eigth Note | ||
+ | |||
t16=0:DELTA:1/16; %%Sixteenth Note | t16=0:DELTA:1/16; %%Sixteenth Note | ||
y=sin(2*pi*E*t8); %%E | y=sin(2*pi*E*t8); %%E | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*E*t4); %%E | y=sin(2*pi*E*t4); %%E | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*E*t8); %%E | y=sin(2*pi*E*t8); %%E | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*G*t8); %%G | y=sin(2*pi*G*t8); %%G | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*C*t8); %%C | y=sin(2*pi*C*t8); %%C | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*E*t4); %%E | y=sin(2*pi*E*t4); %%E | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*G*t2); %%G | y=sin(2*pi*G*t2); %%G | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*C*t4); %%C | y=sin(2*pi*C*t4); %%C | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*Glow*t8); %%G Low | y=sin(2*pi*Glow*t8); %%G Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*Elow*t8); %%E Low | y=sin(2*pi*Elow*t8); %%E Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*Alow*t4); %%A Low | y=sin(2*pi*Alow*t4); %%A Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*Blow*t8); %%B Low | y=sin(2*pi*Blow*t8); %%B Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*AlowSHARP*t8); %%A Sharp Low | y=sin(2*pi*AlowSHARP*t8); %%A Sharp Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
y=sin(2*pi*Alow*t4); %%A Low | y=sin(2*pi*Alow*t4); %%A Low | ||
+ | |||
sound(y,1/DELTA); | sound(y,1/DELTA); | ||
+ | |||
+ | [https://kiwi.ecn.purdue.edu/rhea/index.php/Homework_1 Return to Homework 1] |
Latest revision as of 08:06, 24 June 2009
%%Mario Theme by Ryne Rayburn
clear all
clc
A=440; %%Given Value - Freq. of A
C=A*3/5; %%From Given Table - Middle C
B=15*C/8;
G=3*C/2;
F=4*C/3;
E=5*C/4;
D=9*C/8;
Cup=2*C;
Clow=C/2;
Glow=G/2;
Elow=E/2;
Alow=A/2;
Blow=B/2;
AlowSHARP=233.08;
DELTA=.0001;
t=0:DELTA:1; %%One Second of playing
t2=0:DELTA:.5; %%Half Note
t4=0:DELTA:.25; %%Quarter Note
t8=0:DELTA:.125; %%Eigth Note
t16=0:DELTA:1/16; %%Sixteenth Note
y=sin(2*pi*E*t8); %%E
sound(y,1/DELTA);
y=sin(2*pi*E*t4); %%E
sound(y,1/DELTA);
y=sin(2*pi*E*t8); %%E
sound(y,1/DELTA);
y=sin(2*pi*G*t8); %%G
sound(y,1/DELTA);
y=sin(2*pi*C*t8); %%C
sound(y,1/DELTA);
y=sin(2*pi*E*t4); %%E
sound(y,1/DELTA);
y=sin(2*pi*G*t2); %%G
sound(y,1/DELTA);
y=sin(2*pi*C*t4); %%C
sound(y,1/DELTA);
y=sin(2*pi*Glow*t8); %%G Low
sound(y,1/DELTA);
y=sin(2*pi*Elow*t8); %%E Low
sound(y,1/DELTA);
y=sin(2*pi*Alow*t4); %%A Low
sound(y,1/DELTA);
y=sin(2*pi*Blow*t8); %%B Low
sound(y,1/DELTA);
y=sin(2*pi*AlowSHARP*t8); %%A Sharp Low
sound(y,1/DELTA);
y=sin(2*pi*Alow*t4); %%A Low
sound(y,1/DELTA);