Revision as of 10:57, 4 September 2008 by Nablock (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

% 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

for counter=1:13

       t=0:delta:rhythm(counter);
       d=sin(2*pi*t*notes(counter));
       Sound(d,1/delta);

end

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood