(New page: %Written by: Justin Clark %Purpose: ECE 301 HW 1 %Task: 1a)Play smoke on the water BPM = 112; %number of beats per minute %conversion from BPM to length of duration [seconds] %conversio...)
 
Line 1: Line 1:
%Written by: Justin Clark
+
%Written by: Justin Clark %Purpose: ECE 301 HW 1  
%Purpose: ECE 301 HW 1
+
  
%Task: 1a)Play smoke on the water
+
%Task: 1a)Play smoke on the water  
  
BPM = 112; %number of beats per minute
+
BPM = 112; %number of beats per minute  
  
%conversion from BPM to length of duration [seconds]
+
%conversion from BPM to length of duration [seconds] %conversionfrom http://bradthemad.org/guitar/tempo_explanation.php length = 60/112;  
%conversionfrom http://bradthemad.org/guitar/tempo_explanation.php
+
length = 60/112;
+
  
 +
<br> delta=0.0005;
  
delta=0.0005;
+
fa = 440;&nbsp;%[Hz] fg = (2^((-2)/12)) * fa;%[Hz] fbf = (2^(1/12)) * fa;%[Hz] fc = (2^(3/12)) * fa;%[Hz] fdf = (2^(4/12)) * fa;%[Hz]
  
fa = 440; %[Hz]
+
<br> th = 0:delta:60/112*2;&nbsp;%half note duration [sec] tq = 0:delta:60/112;&nbsp;%quarter note duration [sec] te = 0:delta:60/112/2;&nbsp;%eighth note duration [sec] td = 0:delta:60/112*1.5;&nbsp;%dotted quarter note duration [sec]  
fg = (2^((-2)/12)) * fa;%[Hz]
+
fbf = (2^(1/12)) * fa;%[Hz]
+
fc = (2^(3/12)) * fa;%[Hz]
+
fdf = (2^(4/12)) * fa;%[Hz]
+
  
 +
g = sin(2*pi*fg*tq); hg = sin(2*pi*fg*th); bf = sin(2*pi*fbf*tq); dqc = sin(2*pi*fc*td); hc = sin(2*pi*fc*th); df = sin(2*pi*fdf*te);
  
th = 0:delta:60/112*2; %half note duration [sec]
+
smoke_on_the_water = [g,bf,dqc,g,bf,df,hc,g,bf,dqc,bf,g];  
tq = 0:delta:60/112; %quarter note duration [sec]
+
te = 0:delta:60/112/2; %eighth note duration [sec]
+
td = 0:delta:60/112*1.5; %dotted quarter note duration [sec]
+
  
g = sin(2*pi*fg*tq);
+
sound(smoke_on_the_water,1/delta);  
hg = sin(2*pi*fg*th);
+
bf = sin(2*pi*fbf*tq);
+
dqc = sin(2*pi*fc*td);
+
hc = sin(2*pi*fc*th);
+
df = sin(2*pi*fdf*te);
+
  
smoke_on_the_water = [g,bf,dqc,g,bf,df,hc,g,bf,dqc,bf,g];
+
wavwrite(smoke_on_the_water, 1/delta, 32, 'smokew.wav');  
                 
+
sound(smoke_on_the_water,1/delta);
+
  
wavwrite(smoke_on_the_water, 1/delta, 32, 'smokew.wav');
+
pause(1);  
  
pause(1);
+
%&nbsp;%Task: 1b) play twice as fast
  
%  
+
%cut time duration in half th2 = 0:delta:60/112; tq2 = 0:delta:60/112/2; te2 = 0:delta:60/112/4; td2 = 0:delta:60/112*1.5/2;
%Task: 1b) play twice as fast
+
  
%cut time duration in half
+
%rescale notes g2 = sin(2*pi*fg*tq2); hg2 = sin(2*pi*fg*th2); bf2 = sin(2*pi*fbf*tq2); dqc2 = sin(2*pi*fc*td2); hc2 = sin(2*pi*fc*th2); df2 = sin(2*pi*fdf*te2);  
th2 = 0:delta:60/112;
+
tq2 = 0:delta:60/112/2;
+
te2 = 0:delta:60/112/4;
+
td2 = 0:delta:60/112*1.5/2;
+
  
%rescale notes
+
smoke_on_the_water_twice_speed = [g2,bf2,dqc2,g2,bf2,df2,hc2,g2,bf2,dqc2,bf2,g2];  
g2 = sin(2*pi*fg*tq2);
+
hg2 = sin(2*pi*fg*th2);
+
bf2 = sin(2*pi*fbf*tq2);
+
dqc2 = sin(2*pi*fc*td2);
+
hc2 = sin(2*pi*fc*th2);
+
df2 = sin(2*pi*fdf*te2);
+
  
smoke_on_the_water_twice_speed = [g2,bf2,dqc2,g2,bf2,df2,hc2,g2,bf2,dqc2,bf2,g2];
+
sound(smoke_on_the_water_twice_speed,1/delta);  
  
sound(smoke_on_the_water_twice_speed,1/delta);
+
wavwrite(smoke_on_the_water_twice_speed, 1/delta, 'smokew_fast.wav');  
  
wavwrite(smoke_on_the_water_twice_speed, 1/delta, 'smokew_fast.wav');
+
pause(1);  
  
pause(1);
+
%Task: 1c) rescale original song, x(t), to play as y(t) = x(2t)  
  
%Task: 1c) rescale original song, x(t), to play as y(t) = x(2t)
+
th3 = (0:delta:60/112*2);&nbsp;%half note duration [sec] tq3 = (0:delta:60/112);&nbsp;%quarter note duration [sec] te3 = (0:delta:60/112/2);&nbsp;%eighth note duration [sec] td3 = (0:delta:60/112*1.5);&nbsp;%dotted quarter note duration [sec]
  
th3 = (0:delta:60/112*2); %half note duration [sec]
+
%rescale notes g3 = sin(2*pi*fg*tq3); hg3 = sin(2*pi*fg*th3); bf3 = sin(2*pi*fbf*tq3); dqc3 = sin(2*pi*fc*td3); hc3 = sin(2*pi*fc*th3); df3 = sin(2*pi*fdf*te3);  
tq3 = (0:delta:60/112); %quarter note duration [sec]
+
te3 = (0:delta:60/112/2); %eighth note duration [sec]
+
td3 = (0:delta:60/112*1.5); %dotted quarter note duration [sec]
+
  
%rescale notes
+
smoke_on_the_water_3 = [g3,bf3,dqc3,g3,bf3,df3,hc3,g3,bf3,dqc3,bf3,g3];  
g3  = sin(2*pi*fg*tq3);
+
hg3  = sin(2*pi*fg*th3);
+
bf3 = sin(2*pi*fbf*tq3);
+
dqc3 = sin(2*pi*fc*td3);
+
hc3  = sin(2*pi*fc*th3);
+
df3 = sin(2*pi*fdf*te3);
+
  
smoke_on_the_water_3 = [g3,bf3,dqc3,g3,bf3,df3,hc3,g3,bf3,dqc3,bf3,g3];
+
sound(smoke_on_the_water_3,1/(1/2*delta));  
                             
+
sound(smoke_on_the_water_3,1/(1/2*delta));
+
  
wavwrite(smoke_on_the_water_3, 1/(1/2*delta), 'smokew_3.wav');
+
wavwrite(smoke_on_the_water_3, 1/(1/2*delta), 'smokew_3.wav');  
  
pause(1);
+
pause(1);  
  
 +
<br>&nbsp;%Task: 2)
  
%Task: 2)
+
% What is the forward repeated phrase? "Number nine."  
 
+
% What is the forward repeated phrase? "Number nine."
+
  
 
[Y, Fs] = wavread('Beatles.wav');  
 
[Y, Fs] = wavread('Beatles.wav');  
Line 97: Line 59:
 
Y_Subliminal = flipud(Y);  
 
Y_Subliminal = flipud(Y);  
  
sound(Y, Fs);
+
sound(Y, Fs); sound(Y_Subliminal, Fs);  
sound(Y_Subliminal, Fs);  
+
 
 +
wavwrite(Y_Subliminal,1/delta, 'Beatles_subliminal.wav');
 +
 
 +
<br>
 +
 
 +
https://www.projectrhea.org/rhea/images/7/7d/Smokew.wav
  
wavwrite(Y_Subliminal,1/delta, 'Beatles_subliminal.wav');
+
https://www.projectrhea.org/rhea/index.php/Image:Smokew_fast.wav#file

Revision as of 13:22, 18 January 2011

%Written by: Justin Clark %Purpose: ECE 301 HW 1

%Task: 1a)Play smoke on the water

BPM = 112; %number of beats per minute

%conversion from BPM to length of duration [seconds] %conversionfrom http://bradthemad.org/guitar/tempo_explanation.php length = 60/112;


delta=0.0005;

fa = 440; %[Hz] fg = (2^((-2)/12)) * fa;%[Hz] fbf = (2^(1/12)) * fa;%[Hz] fc = (2^(3/12)) * fa;%[Hz] fdf = (2^(4/12)) * fa;%[Hz]


th = 0:delta:60/112*2; %half note duration [sec] tq = 0:delta:60/112; %quarter note duration [sec] te = 0:delta:60/112/2; %eighth note duration [sec] td = 0:delta:60/112*1.5; %dotted quarter note duration [sec]

g = sin(2*pi*fg*tq); hg = sin(2*pi*fg*th); bf = sin(2*pi*fbf*tq); dqc = sin(2*pi*fc*td); hc = sin(2*pi*fc*th); df = sin(2*pi*fdf*te);

smoke_on_the_water = [g,bf,dqc,g,bf,df,hc,g,bf,dqc,bf,g];

sound(smoke_on_the_water,1/delta);

wavwrite(smoke_on_the_water, 1/delta, 32, 'smokew.wav');

pause(1);

% %Task: 1b) play twice as fast

%cut time duration in half th2 = 0:delta:60/112; tq2 = 0:delta:60/112/2; te2 = 0:delta:60/112/4; td2 = 0:delta:60/112*1.5/2;

%rescale notes g2 = sin(2*pi*fg*tq2); hg2 = sin(2*pi*fg*th2); bf2 = sin(2*pi*fbf*tq2); dqc2 = sin(2*pi*fc*td2); hc2 = sin(2*pi*fc*th2); df2 = sin(2*pi*fdf*te2);

smoke_on_the_water_twice_speed = [g2,bf2,dqc2,g2,bf2,df2,hc2,g2,bf2,dqc2,bf2,g2];

sound(smoke_on_the_water_twice_speed,1/delta);

wavwrite(smoke_on_the_water_twice_speed, 1/delta, 'smokew_fast.wav');

pause(1);

%Task: 1c) rescale original song, x(t), to play as y(t) = x(2t)

th3 = (0:delta:60/112*2); %half note duration [sec] tq3 = (0:delta:60/112); %quarter note duration [sec] te3 = (0:delta:60/112/2); %eighth note duration [sec] td3 = (0:delta:60/112*1.5); %dotted quarter note duration [sec]

%rescale notes g3 = sin(2*pi*fg*tq3); hg3 = sin(2*pi*fg*th3); bf3 = sin(2*pi*fbf*tq3); dqc3 = sin(2*pi*fc*td3); hc3 = sin(2*pi*fc*th3); df3 = sin(2*pi*fdf*te3);

smoke_on_the_water_3 = [g3,bf3,dqc3,g3,bf3,df3,hc3,g3,bf3,dqc3,bf3,g3];

sound(smoke_on_the_water_3,1/(1/2*delta));

wavwrite(smoke_on_the_water_3, 1/(1/2*delta), 'smokew_3.wav');

pause(1);


 %Task: 2)

% What is the forward repeated phrase? "Number nine."

[Y, Fs] = wavread('Beatles.wav');

Y_Subliminal = flipud(Y);

sound(Y, Fs); sound(Y_Subliminal, Fs);

wavwrite(Y_Subliminal,1/delta, 'Beatles_subliminal.wav');


https://www.projectrhea.org/rhea/images/7/7d/Smokew.wav

https://www.projectrhea.org/rhea/index.php/Image:Smokew_fast.wav#file

Alumni Liaison

ECE462 Survivor

Seraj Dosenbach