Line 1: Line 1:
clc;<br>clear all;  
+
clc;<br>clear all;
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 1&nbsp;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
bpm = 112;<br>bps = bpm / 60;<br>spb = 1/bps;<br>delta = 0.00005;<br>t = 0:delta:3;  
+
bpm = 112;<br>bps = bpm / 60;<br>spb = 1/bps;<br>delta = 0.00005;<br>t = 0:delta:3;
  
E = 0:delta:spb/2;<br>Q = 0:delta:spb;<br>H = 0:delta:spb*2;<br>DQ = 0:delta:3*spb/2;  
+
E = 0:delta:spb/2;<br>Q = 0:delta:spb;<br>H = 0:delta:spb*2;<br>DQ = 0:delta:3*spb/2;
  
G = 391.995;<br>Bf = 466.164;<br>C = 523.251;<br>Df = 554.365;  
+
E2 = 0:delta:spb/4;<br>Q2 = 0:delta:spb/2;<br>H2 = 0:delta:spb;<br>DQ2 = 0:delta:3*spb/4;
  
smoke_on_water = [sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),...<br>sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*Df*E),sin(2*pi*C*H),...<br>sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),sin(2*pi*Bf*Q),...<br>sin(2*pi*G*Q)];  
+
G = 391.995;<br>Bf = 466.164;<br>C = 523.251;<br>Df = 554.365;
  
sound(smoke_on_water,1/delta);<br>sound(smoke_on_water,2/delta);<br>sound(smoke_on_water,1/(2*delta));  
+
smoke_on_water = [sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),...<br> sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*Df*E),sin(2*pi*C*H),...<br> sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),sin(2*pi*Bf*Q),...<br> sin(2*pi*G*Q)];<br>smoke_on_water2 = [sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),...<br> sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*Df*E2),sin(2*pi*C*H2),...<br> sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),sin(2*pi*Bf*Q2),...<br> sin(2*pi*G*Q2)];
  
wavwrite(smoke_on_water,1/delta,'ECEHW1_1_a');<br>wavwrite(smoke_on_water,2/delta,'ECEHW1_1_b');<br>wavwrite(smoke_on_water,1/(2*delta),'ECEHW1_1_c');  
+
sound(smoke_on_water,1/delta);<br>sound(smoke_on_water2,1/delta);<br>sound(smoke_on_water,2/delta);
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 2&nbsp;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
wavwrite(smoke_on_water,1/delta,'ECEHW1_1_a');<br>wavwrite(smoke_on_water2,1/delta,'ECEHW1_1_b');<br>wavwrite(smoke_on_water,2/delta,'ECEHW1_1_c');
  
[beatles, Fs] = wavread('Beatles.wav');<br>sound(beatles,Fs);
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
beatles_rev = flipud(beatles);<br>sound(beatles_rev,Fs);<br>wavwrite(beatles_rev,Fs,'ECEHW1_2_b');  
+
[beatles, Fs] = wavread('Beatles.wav');<br>sound(beatles,Fs);
  
<br>
+
beatles_rev = flipud(beatles);<br>sound(beatles_rev,Fs);<br>wavwrite(beatles_rev,Fs,'ECEHW1_2_b');<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
  
[[Media:ECEHW1_1_a.wav]]
+
<br> [[Media:ECEHW1_1_a.wav]] <br> [[Media:ECEHW1_1_b.wav]] <br> [[Media:ECEHW1_1_c.wav]] <br>
<br/>
+
[[Media:ECEHW1_1_b.wav]]
+
<br/>
+
[[Media:ECEHW1_1_c.wav]]
+
<br/>
+

Revision as of 14:31, 18 January 2011

clc;
clear all;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

bpm = 112;
bps = bpm / 60;
spb = 1/bps;
delta = 0.00005;
t = 0:delta:3;

E = 0:delta:spb/2;
Q = 0:delta:spb;
H = 0:delta:spb*2;
DQ = 0:delta:3*spb/2;

E2 = 0:delta:spb/4;
Q2 = 0:delta:spb/2;
H2 = 0:delta:spb;
DQ2 = 0:delta:3*spb/4;

G = 391.995;
Bf = 466.164;
C = 523.251;
Df = 554.365;

smoke_on_water = [sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),...
sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*Df*E),sin(2*pi*C*H),...
sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),sin(2*pi*Bf*Q),...
sin(2*pi*G*Q)];
smoke_on_water2 = [sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),...
sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*Df*E2),sin(2*pi*C*H2),...
sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),sin(2*pi*Bf*Q2),...
sin(2*pi*G*Q2)];

sound(smoke_on_water,1/delta);
sound(smoke_on_water2,1/delta);
sound(smoke_on_water,2/delta);

wavwrite(smoke_on_water,1/delta,'ECEHW1_1_a');
wavwrite(smoke_on_water2,1/delta,'ECEHW1_1_b');
wavwrite(smoke_on_water,2/delta,'ECEHW1_1_c');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

beatles_rev = flipud(beatles);
sound(beatles_rev,Fs);
wavwrite(beatles_rev,Fs,'ECEHW1_2_b');


Media:ECEHW1_1_a.wav
Media:ECEHW1_1_b.wav
Media:ECEHW1_1_c.wav

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009