(working code)
 
Line 1: Line 1:
Yes, I have found a way to play the song using only one call to the sound command, and will post it here once I'm comfortable with it.
+
% Tylor Thompson
  
-Ty
+
% ECE 301
 +
 
 +
% Mario Theme Song - First 5 measures
 +
 
 +
clear all
 +
 
 +
clc
 +
 
 +
delta = 0.0001;
 +
 
 +
t = 0:delta:20;
 +
 
 +
a = sin(2*pi*659.26*t).*(t<.25) + sin(2*pi*659.26*t).*(t>.25 & t<.75) + sin(2*pi*659.26*t).*(t>.75 & t<1) + sin(2*pi*523.25*t).*(t>1.25 & t<1.5) + sin(2*pi*659.26*t).*(t>1.5 & t<2) + sin(2*pi*783.99*t).*(t>2 & t<3) + sin(2*pi*392*t).*(t>3 & t<4);
 +
 
 +
b = sin(2*pi*523.25*t).*(t>4 & t<4.75) + sin(2*pi*392*t).*(t>4.75 & t<5) + sin(2*pi*329.63*t).*(t>5.5 & t<6) + sin(2*pi*440*t).*(t>6.25 & t<6.75) + sin(2*pi*493.88*t).*(t>6.75 & t<7) + sin(2*pi*466.16*t).*(t>7.25 & t<7.5) + sin(2*pi*440*t).*(t>7.5 & t<8);
 +
 
 +
c = sin(2*pi*392*t).*(t>8 & t<8.375) + sin(2*pi*659.26*t).*(t>8.375 & t<8.75) + sin(2*pi*783.99*t).*(t>8.75 & t<9) + sin(2*pi*880*t).*(t>9 & t<9.5) + sin(2*pi*698.46*t).*(t>9.5 & t<9.75) + sin(2*pi*783.99*t).*(t>9.75 & t<10) + sin(2*pi*659.26*t).*(t>10.25 & t<10.75) + sin(2*pi*523.25*t).*(t>10.75 & t<11) + sin(2*pi*587.33*t).*(t>11 & t<11.25) + sin(2*pi*493.88*t).*(t>11.25 & t<12);
 +
 
 +
d = sin(2*pi*523.25*t).*(t>12 & t<12.75) + sin(2*pi*392*t).*(t>12.75 & t<13) + sin(2*pi*329.63*t).*(t>13.5 & t<14) + sin(2*pi*440*t).*(t>14.25 & t<14.75) + sin(2*pi*493.88*t).*(t>14.75 & t<15) + sin(2*pi*466.16*t).*(t>15.25 & t<15.5) + sin(2*pi*440*t).*(t>15.5 & t<16);
 +
 
 +
e = sin(2*pi*392*t).*(t>16 & t<16.375) + sin(2*pi*659.26*t).*(t>16.375 & t<16.75) + sin(2*pi*783.99*t).*(t>16.75 & t<17) + sin(2*pi*880*t).*(t>17 & t<17.5) + sin(2*pi*698.46*t).*(t>17.5 & t<17.75) + sin(2*pi*783.99*t).*(t>17.75 & t<18) + sin(2*pi*659.26*t).*(t>18.25 & t<18.75) + sin(2*pi*523.25*t).*(t>18.75 & t<19) + sin(2*pi*587.33*t).*(t>19 & t<19.25) + sin(2*pi*493.88*t).*(t>19.25 & t<20);
 +
 
 +
phrase1 = a + b + c + d + e;
 +
 
 +
sound(phrase1,1/delta)

Latest revision as of 16:15, 24 June 2009

% Tylor Thompson

% ECE 301

% Mario Theme Song - First 5 measures

clear all

clc

delta = 0.0001;

t = 0:delta:20;

a = sin(2*pi*659.26*t).*(t<.25) + sin(2*pi*659.26*t).*(t>.25 & t<.75) + sin(2*pi*659.26*t).*(t>.75 & t<1) + sin(2*pi*523.25*t).*(t>1.25 & t<1.5) + sin(2*pi*659.26*t).*(t>1.5 & t<2) + sin(2*pi*783.99*t).*(t>2 & t<3) + sin(2*pi*392*t).*(t>3 & t<4);

b = sin(2*pi*523.25*t).*(t>4 & t<4.75) + sin(2*pi*392*t).*(t>4.75 & t<5) + sin(2*pi*329.63*t).*(t>5.5 & t<6) + sin(2*pi*440*t).*(t>6.25 & t<6.75) + sin(2*pi*493.88*t).*(t>6.75 & t<7) + sin(2*pi*466.16*t).*(t>7.25 & t<7.5) + sin(2*pi*440*t).*(t>7.5 & t<8);

c = sin(2*pi*392*t).*(t>8 & t<8.375) + sin(2*pi*659.26*t).*(t>8.375 & t<8.75) + sin(2*pi*783.99*t).*(t>8.75 & t<9) + sin(2*pi*880*t).*(t>9 & t<9.5) + sin(2*pi*698.46*t).*(t>9.5 & t<9.75) + sin(2*pi*783.99*t).*(t>9.75 & t<10) + sin(2*pi*659.26*t).*(t>10.25 & t<10.75) + sin(2*pi*523.25*t).*(t>10.75 & t<11) + sin(2*pi*587.33*t).*(t>11 & t<11.25) + sin(2*pi*493.88*t).*(t>11.25 & t<12);

d = sin(2*pi*523.25*t).*(t>12 & t<12.75) + sin(2*pi*392*t).*(t>12.75 & t<13) + sin(2*pi*329.63*t).*(t>13.5 & t<14) + sin(2*pi*440*t).*(t>14.25 & t<14.75) + sin(2*pi*493.88*t).*(t>14.75 & t<15) + sin(2*pi*466.16*t).*(t>15.25 & t<15.5) + sin(2*pi*440*t).*(t>15.5 & t<16);

e = sin(2*pi*392*t).*(t>16 & t<16.375) + sin(2*pi*659.26*t).*(t>16.375 & t<16.75) + sin(2*pi*783.99*t).*(t>16.75 & t<17) + sin(2*pi*880*t).*(t>17 & t<17.5) + sin(2*pi*698.46*t).*(t>17.5 & t<17.75) + sin(2*pi*783.99*t).*(t>17.75 & t<18) + sin(2*pi*659.26*t).*(t>18.25 & t<18.75) + sin(2*pi*523.25*t).*(t>18.75 & t<19) + sin(2*pi*587.33*t).*(t>19 & t<19.25) + sin(2*pi*493.88*t).*(t>19.25 & t<20);

phrase1 = a + b + c + d + e;

sound(phrase1,1/delta)

Alumni Liaison

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva