(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
%File #1<br> | %File #1<br> | ||
− | %Shi Jia<br>%ECE301<br>function output()<br>%DEFINE<br>BPM = 112;<br>BEAT = 60/BPM*4;<br>RATE = 48000 | + | %Shi Jia<br>%ECE301<br>function output()<br>%DEFINE CONSANTS<br>BPM = 112;<br>BEAT = 60/BPM*4;<br>RATE = 48000; |
− | + | %MESSY VECTOR GENERATION<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 1)]; %bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 1)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)]; %C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)]; %bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G<br>sound(WAV, RATE);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, .5)]; %bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, .5)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)]; %C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)]; %bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)]; %G<br>sound(WAV, RATE*2);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 2)]; %bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 2)]; %C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)]; %C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)]; %bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)]; %G<br>sound(WAV, RATE); | |
− | function OUT = note(OFFSET, LENGTH, RATE, MULT)<br>OUT = sin(2*pi*(440*2^(OFFSET/12))*MULT*[0:1/RATE:LENGTH]);<br>end | + | end |
+ | |||
+ | %Generates a single note | ||
+ | |||
+ | function OUT = note(OFFSET, LENGTH, RATE, MULT)<br>OUT = sin(2*pi*(440*2^(OFFSET/12))*MULT*[0:1/RATE:LENGTH]);<br>end | ||
+ | |||
+ | [https://www.projectrhea.org/rhea/images/1/17/1.wav www.projectrhea.org/rhea/images/1/17/1.wav] | ||
+ | |||
+ | [https://www.projectrhea.org/rhea/images/c/ce/2.wav www.projectrhea.org/rhea/images/c/ce/2.wav] | ||
+ | |||
+ | [https://www.projectrhea.org/rhea/images/0/05/3.wav www.projectrhea.org/rhea/images/0/05/3.wav] | ||
%File #2<br> | %File #2<br> | ||
− | function reverse()<br>[Y, FS] = wavread('Beatles');<br>wavplay(Y, FS); %"Number nine" is repeated over and over.<br>Y = flipud(Y);<br>wavplay(Y, FS); <br>%It would appear that he's saying something with the word<br>%"money" in it, but it's far more likely that I'm just associating<br>%nonsensical sounds with real words <br>wavwrite(Y, FS, 'reversed');<br>end<br> | + | function reverse()<br>[Y, FS] = wavread('Beatles');<br>wavplay(Y, FS); %"Number nine" is repeated over and over.<br>Y = flipud(Y);<br>wavplay(Y, FS); <br>%It would appear that he's saying something with the word<br>%"money" in it, but it's far more likely that I'm just associating<br>%nonsensical sounds with real words <br>wavwrite(Y, FS, 'reversed');<br>end<br> |
+ | |||
+ | [https://www.projectrhea.org/rhea/images/0/04/Reversed.wav www.projectrhea.org/rhea/images/0/04/Reversed.wav] |
Latest revision as of 17:03, 13 January 2011
%File #1
%Shi Jia
%ECE301
function output()
%DEFINE CONSANTS
BPM = 112;
BEAT = 60/BPM*4;
RATE = 48000;
%MESSY VECTOR GENERATION
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
%Generates a single note
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