Line 1: Line 1:
 +
==Sound Files==
 +
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduereg.wav
 +
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduefast.wav
 +
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduehigh.wav
 +
 
==MATLAB Code==
 
==MATLAB Code==
 
<pre>
 
<pre>
Line 42: Line 47:
  
 
% Regular time
 
% Regular time
 
+
HailPurduereg = [];
 
for counter=1:13
 
for counter=1:13
 
         t=0:delta:rhythm(counter);
 
         t=0:delta:rhythm(counter);
 
         d=sin(2*pi*t*notes(counter));
 
         d=sin(2*pi*t*notes(counter));
 
         Sound(d,1/delta);
 
         Sound(d,1/delta);
 +
        HailPurduereg=[HailPurduereg, d];
 
end
 
end
 +
wavwrite(HailPurduereg,44100,32,'N:\hailpurduereg.wav');
 +
 
pause(2);
 
pause(2);
 
 
% Part B
 
% Part B
 
+
HailPurduefast = [];
 
for counter=1:13
 
for counter=1:13
 
         t=0:delta:.5*rhythm(counter);
 
         t=0:delta:.5*rhythm(counter);
 
         d=sin(2*pi*t*notes(counter));
 
         d=sin(2*pi*t*notes(counter));
 
         Sound(d,1/delta);
 
         Sound(d,1/delta);
 +
        HailPurduefast=[HailPurduefast, d];
 
end
 
end
 +
wavwrite(HailPurduefast,44100,32,'N:\hailpurduefast.wav');
 +
 
pause(2);
 
pause(2);
 
 
% Part C
 
% Part C
 
+
HailPurduehigh = [];
 
for counter=1:13
 
for counter=1:13
 
         t=0:delta:rhythm(counter);
 
         t=0:delta:rhythm(counter);
 
         d=sin(2*pi*t*2*notes(counter));
 
         d=sin(2*pi*t*2*notes(counter));
 
         Sound(d,1/delta);
 
         Sound(d,1/delta);
 +
        HailPurduehigh=[HailPurduehigh, d];
 
end
 
end
 +
wavwrite(HailPurduehigh,44100,32,'N:\hailpurduehigh.wav');
 +
 
</pre>
 
</pre>

Revision as of 08:07, 5 September 2008

Sound Files

http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduereg.wav http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduefast.wav http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduehigh.wav

MATLAB Code

% Nicholas Block
% ECE301 Fall 2008
% Homework #1

clear;
clc;

% Part A

% Define frequencies
% All frequencies found using equations from HW sheet

B = 495;
A = 440;
G = 396;
F = 352; 
E = 330;
D = 297;
C = 264;

% Define note durations
% Assuming bpm=135

% Quarter note
Qn = 60/135;
% Eighth note
En = Qn/2;
% Half note
Hn = Qn *2;
% Whole note
Wn = Qn *4;

% Sample rate
delta = 1/44100;

% Melody

notes = [G, A, B, C, D, E, E, F, F, F, C, D, E];
rhythm = [Hn, Qn, Qn, Qn, En, Qn, Qn, Qn, En, En, Qn, Qn, Hn];

% Regular time
HailPurduereg = [];
for counter=1:13
        t=0:delta:rhythm(counter);
        d=sin(2*pi*t*notes(counter));
        Sound(d,1/delta);
        HailPurduereg=[HailPurduereg, d];
end
wavwrite(HailPurduereg,44100,32,'N:\hailpurduereg.wav');

pause(2);
% Part B
HailPurduefast = [];
for counter=1:13
        t=0:delta:.5*rhythm(counter);
        d=sin(2*pi*t*notes(counter));
        Sound(d,1/delta);
        HailPurduefast=[HailPurduefast, d];
end
wavwrite(HailPurduefast,44100,32,'N:\hailpurduefast.wav');

pause(2);
% Part C
HailPurduehigh = [];
for counter=1:13
        t=0:delta:rhythm(counter);
        d=sin(2*pi*t*2*notes(counter));
        Sound(d,1/delta);
        HailPurduehigh=[HailPurduehigh, d];
end
wavwrite(HailPurduehigh,44100,32,'N:\hailpurduehigh.wav');

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang