(New page: %Daniel Sabo %ECE 301 %HW 1 %Part 1 delta = .00005; bps = 112/60; whole = 0:delta:bps; half = 0:delta:bps/2; quarter = 0:delta:bps/4; eigth = 0:delta:bps/8; dotted_q = 0:delta:bps*.375;...)
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
%Daniel Sabo
+
%Daniel Sabo<br>
%ECE 301
+
%ECE 301<br>
%HW 1
+
%HW 1<br>
  
%Part 1
+
%Part 1<br>
  
delta = .00005;
+
delta = .00005;<br>
bps = 112/60;
+
  
whole = 0:delta:bps;
+
bps = 112/60;<br>
half = 0:delta:bps/2;
+
quarter = 0:delta:bps/4;
+
eigth = 0:delta:bps/8;
+
dotted_q = 0:delta:bps*.375;
+
  
G = 391.995;
+
whole = 0:delta:bps;<br>
Bf = 466.164;
+
half = 0:delta:bps/2;<br>
C = 523.251;
+
quarter = 0:delta:bps/4;<br>
Df = 554.365;  
+
eighth = 0:delta:bps/8;<br>
 +
dotted_q = 0:delta:bps*.375;<br>
  
note_G = sin(2*pi*G*quarter);
+
G = 391.995;<br>
note_Bf = sin(2*pi*Bf*quarter);
+
Bf = 466.164;<br>
note_C_dotted = sin(2*pi*C*dotted_q);
+
C = 523.251;<br>
note_C_half = sin(2*pi*C*half);  
+
Df = 554.365;<br>
note_Df = sin(2*pi*Df*eigth);
+
  
normal = [note_G,note_Bf,note_C_dotted,note_G,...
+
note_G = sin(2*pi*G*quarter);<br>
          note_Bf,note_Df,note_C_half,note_G,...
+
note_Bf = sin(2*pi*Bf*quarter);<br>
          note_Bf,note_C_dotted,note_Bf,note_G];
+
note_C_dotted = sin(2*pi*C*dotted_q);<br>
 +
note_C_half = sin(2*pi*C*half);<br>
 +
note_Df = sin(2*pi*Df*eigth);<br>
 +
 
 +
normal = [note_G,note_Bf,note_C_dotted,note_G,note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];<br>
 
        
 
        
bps = bps/2;
+
bps = bps/2;<br>
  
whole = 0:delta:bps;
+
whole = 0:delta:bps;<br>
half = 0:delta:bps/2;
+
half = 0:delta:bps/2;<br>
quarter = 0:delta:bps/4;
+
quarter = 0:delta:bps/4;<br>
eigth = 0:delta:bps/8;
+
eigth = 0:delta:bps/8;<br>
dotted_q = 0:delta:bps*.375;
+
dotted_q = 0:delta:bps*.375;<br>
  
note_G = sin(2*pi*G*quarter);
+
note_G = sin(2*pi*G*quarter);<br>
note_Bf = sin(2*pi*Bf*quarter);
+
note_Bf = sin(2*pi*Bf*quarter);<br>
note_C_dotted = sin(2*pi*C*dotted_q);
+
note_C_dotted = sin(2*pi*C*dotted_q);<br>
note_C_half = sin(2*pi*C*half);  
+
note_C_half = sin(2*pi*C*half);<br>
note_Df = sin(2*pi*Df*eigth);
+
note_Df = sin(2*pi*Df*eigth);<br>
  
faster = [note_G,note_Bf,note_C_dotted,note_G,...
+
faster = [note_G,note_Bf,note_C_dotted,note_G, note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];<br>
          note_Bf,note_Df,note_C_half,note_G,...
+
          note_Bf,note_C_dotted,note_Bf,note_G];
+
  
whole = 0:delta:bps;
+
whole = 0:delta:bps;<br>
half = 0:delta:bps/2;
+
half = 0:delta:bps/2;<br>
quarter = 0:delta:bps/4;
+
quarter = 0:delta:bps/4;<br>
eigth = 0:delta:bps/8;
+
eigth = 0:delta:bps/8;<br>
dotted_q = 0:delta:bps*.375;
+
dotted_q = 0:delta:bps*.375;<br>
  
G = 2*G;
+
G = 2*G;<br>
Bf = 2*Bf;
+
Bf = 2*Bf;<br>
C = 2*C;
+
C = 2*C;<br>
Df = 2*Df;  
+
Df = 2*Df;<br>
  
note_G = sin(2*pi*G*quarter);
+
note_G = sin(2*pi*G*quarter);<br>
note_Bf = sin(2*pi*Bf*quarter);
+
note_Bf = sin(2*pi*Bf*quarter);<br>
note_C_dotted = sin(2*pi*C*dotted_q);
+
note_C_dotted = sin(2*pi*C*dotted_q);<br>
note_C_half = sin(2*pi*C*half);  
+
note_C_half = sin(2*pi*C*half);<br>
note_Df = sin(2*pi*Df*eigth);
+
note_Df = sin(2*pi*Df*eigth);<br>
  
higher = [note_G,note_Bf,note_C_dotted,note_G,...
+
higher = [note_G,note_Bf,note_C_dotted,note_G,note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];<br>
          note_Bf,note_Df,note_C_half,note_G,...
+
          note_Bf,note_C_dotted,note_Bf,note_G];
+
 
    
 
    
wavwrite(normal, 1/delta,'Normal');
+
wavwrite(normal, 1/delta,'Normal');<br>
wavwrite(faster, 1/delta,'Twice_Speed');
+
wavwrite(faster, 1/delta,'Twice_Speed');<br>
wavwrite(higher, 1/delta,'Higher_Pitch');
+
wavwrite(higher, 1/delta,'Higher_Pitch');<br>
 +
 
 +
%Part 2<br>
 +
[beatles, fs, bits] = wavread('Beatles.wav'); <br>
 +
sound(beatles, fs, bits);<br>
 +
reverse = flipud(beatles);<br>
 +
sound(reverse,fs);<br>
 +
wavwrite(reverse,fs,'Beatles_Reverse');<br>
 +
 
 +
%1. Repeated phrase is "Number 9".<br>
 +
%2. I hear "Let me on Desmond". Who Desmond is I have no idea.
  
%Part 2
+
[[Media:Normal.wav]]<br>
[beatles, fs, bits] = wavread('Beatles.wav');
+
[[Media:Twice_Speed.wav]]<br>
sound(beatles, fs, bits);
+
[[Media:Higher_Pitch.wav]]<br>
reverse = flipud(beatles);
+
[[Media:Beatles_Reverse.wav]]<br>
sound(reverse,fs);
+
wavwrite(reverse,fs,'Beatles_Reverse');
+

Latest revision as of 12:14, 14 January 2011

%Daniel Sabo
%ECE 301
%HW 1

%Part 1

delta = .00005;

bps = 112/60;

whole = 0:delta:bps;
half = 0:delta:bps/2;
quarter = 0:delta:bps/4;
eighth = 0:delta:bps/8;
dotted_q = 0:delta:bps*.375;

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

note_G = sin(2*pi*G*quarter);
note_Bf = sin(2*pi*Bf*quarter);
note_C_dotted = sin(2*pi*C*dotted_q);
note_C_half = sin(2*pi*C*half);
note_Df = sin(2*pi*Df*eigth);

normal = [note_G,note_Bf,note_C_dotted,note_G,note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];

bps = bps/2;

whole = 0:delta:bps;
half = 0:delta:bps/2;
quarter = 0:delta:bps/4;
eigth = 0:delta:bps/8;
dotted_q = 0:delta:bps*.375;

note_G = sin(2*pi*G*quarter);
note_Bf = sin(2*pi*Bf*quarter);
note_C_dotted = sin(2*pi*C*dotted_q);
note_C_half = sin(2*pi*C*half);
note_Df = sin(2*pi*Df*eigth);

faster = [note_G,note_Bf,note_C_dotted,note_G, note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];

whole = 0:delta:bps;
half = 0:delta:bps/2;
quarter = 0:delta:bps/4;
eigth = 0:delta:bps/8;
dotted_q = 0:delta:bps*.375;

G = 2*G;
Bf = 2*Bf;
C = 2*C;
Df = 2*Df;

note_G = sin(2*pi*G*quarter);
note_Bf = sin(2*pi*Bf*quarter);
note_C_dotted = sin(2*pi*C*dotted_q);
note_C_half = sin(2*pi*C*half);
note_Df = sin(2*pi*Df*eigth);

higher = [note_G,note_Bf,note_C_dotted,note_G,note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,note_G];

wavwrite(normal, 1/delta,'Normal');
wavwrite(faster, 1/delta,'Twice_Speed');
wavwrite(higher, 1/delta,'Higher_Pitch');

%Part 2
[beatles, fs, bits] = wavread('Beatles.wav');
sound(beatles, fs, bits);
reverse = flipud(beatles);
sound(reverse,fs);
wavwrite(reverse,fs,'Beatles_Reverse');

%1. Repeated phrase is "Number 9".
%2. I hear "Let me on Desmond". Who Desmond is I have no idea.

Media:Normal.wav
Media:Twice_Speed.wav
Media:Higher_Pitch.wav
Media:Beatles_Reverse.wav

Alumni Liaison

EISL lab graduate

Mu Qiao