HW1, ECE301, Prof. Boutin

In this homework assignment, we were asked to write a Matlab code to play the "Hail Purdue" song with different speeds and pitch. Here are my results:

Media:Song1_ECE301Fall2008mboutin.wav


Matlab Code

delta = 0.00005;
o = (0:delta:0.05);
O = (0:delta:0.5);
c2 = sin(2*pi*262*(0:delta:1));
d1 = sin(2*pi*294*(0:delta:.5));
e1 = sin(2*pi*330*(0:delta:.5));
f2 = sin(2*pi*349*(0:delta:.75));
f1 = sin(2*pi*349*(0:delta:.50));
f = sin(2*pi*349*(0:delta:.25));
g = sin(2*pi*392*(0:delta:.25));
g1 = sin(2*pi*392*(0:delta:0.5));
g2 = sin(2*pi*392*(0:delta:0.5));
a1 = sin(2*pi*440*(0:delta:.50));
a = sin(2*pi*440*(0:delta:0.25));
a2 = sin(2*pi*440*(0:delta:1));
bb1 = sin(2*pi*466*(0:delta:.50));
bb = sin(2*pi*466*(0:delta:0.25));

notes1=[c2,d1,e1,f2,o,g,a1,o,a1,bb1,o,bb,o,bb,f1,g,o,g,a2,O,a2,o,a1,g1,f2,g,a1,o,a,o,a,g1,d1,f,e1,f,g1,g1];
sound (notes1,1/delta);
wavwrite(notes1,1/delta,32,'song1.wav');

delta = 0.000005;
o = (0:delta:0.025);
O = (0:delta:0.25);
c2 = sin(2*pi*262*(0:delta:.5));
d1 = sin(2*pi*294*(0:delta:.25));
e1 = sin(2*pi*330*(0:delta:.25));
f2 = sin(2*pi*349*(0:delta:.5));
f1 = sin(2*pi*349*(0:delta:.250));
f = sin(2*pi*349*(0:delta:.125));
g = sin(2*pi*392*(0:delta:.125));
g1 = sin(2*pi*392*(0:delta:0.25));
g2 = sin(2*pi*392*(0:delta:0.5));
a1 = sin(2*pi*440*(0:delta:.250));
a = sin(2*pi*440*(0:delta:0.125));
a2 = sin(2*pi*440*(0:delta:.5));
bb1 = sin(2*pi*466*(0:delta:.250));
bb = sin(2*pi*466*(0:delta:0.125));

notes2=[c2,d1,e1,f2,o,g,a1,o,a1,bb1,o,bb,o,bb,f1,g,o,g,a2,O,a2,o,a1,g1,f2,g,a1,o,a,o,a,g1,d1,f,e1,f,g1,g1];
sound (notes2,1/delta);
wavwrite(notes2,1/delta,32,'song2.wav');


delta = 0.00005;
o = (0:delta:0.05);
O = (0:delta:0.5);
c2 = sin(4*pi*262*(0:delta:1));
d1 = sin(4*pi*294*(0:delta:.5));
e1 = sin(4*pi*330*(0:delta:.5));
f2 = sin(4*pi*349*(0:delta:.75));
f1 = sin(4*pi*349*(0:delta:.50));
f = sin(4*pi*349*(0:delta:.25));
g = sin(4*pi*392*(0:delta:.25));
g1 = sin(4*pi*392*(0:delta:0.5));
g2 = sin(4*pi*392*(0:delta:0.5));
a1 = sin(4*pi*440*(0:delta:.50));
a = sin(4*pi*440*(0:delta:0.25));
a2 = sin(4*pi*440*(0:delta:1));
bb1 = sin(4*pi*466*(0:delta:.50));
bb = sin(4*pi*466*(0:delta:0.25));

notes3=[c2,d1,e1,f2,o,g,a1,o,a1,bb1,o,bb,o,bb,f1,g,o,g,a2,O,a2,o,a1,g1,f2,g,a1,o,a,o,a,g1,d1,f,e1,f,g1,g1];
sound (notes3,1/delta);
wavwrite(notes3,1/delta,32,'song3.wav');

list1 = [notes1,notes2,notes3];

wavwrite(list1,1/delta,32,'list.wav');
wavwrite([notes1,notes2,notes3],1/delta,32,'list2.wav');

Sound Files

Media:Song1_ECE301Fall2008mboutin.wav

Alumni Liaison

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

Francisco Blanco-Silva