(New page: %File #1<br> %Shi Jia<br>%ECE301<br>function output()<br>%DEFINE<br>BPM = 112;<br>BEAT = 60/BPM*4;<br>RATE = 48000;<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)]; %G<br>WA...)
 
Line 3: Line 3:
 
%Shi Jia<br>%ECE301<br>function output()<br>%DEFINE<br>BPM = 112;<br>BEAT = 60/BPM*4;<br>RATE = 48000;<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 1)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>sound(WAV, RATE);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, .5)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>sound(WAV, RATE*2);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 2)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>sound(WAV, RATE);  
 
%Shi Jia<br>%ECE301<br>function output()<br>%DEFINE<br>BPM = 112;<br>BEAT = 60/BPM*4;<br>RATE = 48000;<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 1)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 1)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 1)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 1)];&nbsp;%G<br>sound(WAV, RATE);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, .5)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, .5)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, .5)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, .5)];&nbsp;%G<br>sound(WAV, RATE*2);<br>WAV = [];<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(4, 1/8*BEAT, RATE, 2)];&nbsp;%bD<br>WAV = [WAV note(3, 2/4*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%G<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(3, 3/8*BEAT, RATE, 2)];&nbsp;%C<br>WAV = [WAV note(1, 1/4*BEAT, RATE, 2)];&nbsp;%bB<br>WAV = [WAV note(-2, 1/4*BEAT, RATE, 2)];&nbsp;%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><br>  
+
end
 +
 
 +
function OUT = note(OFFSET, LENGTH, RATE, MULT)<br>OUT = sin(2*pi*(440*2^(OFFSET/12))*MULT*[0:1/RATE:LENGTH]);<br>end<br>  
  
 
%File #2<br>  
 
%File #2<br>  
  
 
function reverse()<br>[Y, FS] = wavread('Beatles');<br>wavplay(Y, FS);&nbsp;%"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);&nbsp;%"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>

Revision as of 16:56, 13 January 2011

%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

%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

Alumni Liaison

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

Alumni Liaison