Revision as of 17:01, 13 January 2011 by Sjia (Talk | contribs)

%File #1

%Shi Jia
%ECE301
function output()
%DEFINE
BPM = 112;
BEAT = 60/BPM*4;
RATE = 48000;
WAV = [];
WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, 1)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB
WAV = [WAV note(4, 1/8*BEAT, RATE, 1)]; %bD
WAV = [WAV note(3, 2/4*BEAT, RATE, 1)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, 1)]; %C
WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB
WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G
sound(WAV, RATE);
WAV = [];
WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, .5)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB
WAV = [WAV note(4, 1/8*BEAT, RATE, .5)]; %bD
WAV = [WAV note(3, 2/4*BEAT, RATE, .5)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, .5)]; %C
WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB
WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G
sound(WAV, RATE*2);
WAV = [];
WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, 2)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB
WAV = [WAV note(4, 1/8*BEAT, RATE, 2)]; %bD
WAV = [WAV note(3, 2/4*BEAT, RATE, 2)]; %C
WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G
WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB
WAV = [WAV note(3, 3/8*BEAT, RATE, 2)]; %C
WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB
WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G
sound(WAV, RATE);

end

function OUT = note(OFFSET, LENGTH, RATE, MULT)
OUT = sin(2*pi*(440*2^(OFFSET/12))*MULT*[0:1/RATE:LENGTH]);
end

www.projectrhea.org/rhea/images/1/17/1.wav

www.projectrhea.org/rhea/images/c/ce/2.wav

www.projectrhea.org/rhea/images/0/05/3.wav

%File #2

function reverse()
[Y, FS] = wavread('Beatles');
wavplay(Y, FS); %"Number nine" is repeated over and over.
Y = flipud(Y);
wavplay(Y, FS);
%It would appear that he's saying something with the word
%"money" in it, but it's far more likely that I'm just associating
%nonsensical sounds with real words
wavwrite(Y, FS, 'reversed');
end

www.projectrhea.org/rhea/images/0/04/Reversed.wav

Alumni Liaison

Have a piece of advice for Purdue students? Share it through Rhea!

Alumni Liaison