Sound Files
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/9/97/Hailpurduereg.wav
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/5/54/Hailpurduefast.wav
http://kiwi.ecn.purdue.edu/ECE301Fall2008mboutin/images/c/c6/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');