(5 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; | + | bps = 112/60;<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> |
− | eighth = 0:delta:bps/8; | + | eighth = 0:delta:bps/8;<br> |
− | dotted_q = 0:delta:bps*.375; | + | dotted_q = 0:delta:bps*.375;<br> |
− | G = 391.995; | + | G = 391.995;<br> |
− | Bf = 466.164; | + | Bf = 466.164;<br> |
− | C = 523.251; | + | C = 523.251;<br> |
− | Df = 554.365; | + | Df = 554.365;<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> |
− | 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]; | + | 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, note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,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> |
− | 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; Bf = 2*Bf; C = 2*C; Df = 2*Df; | + | G = 2*G;<br> |
+ | Bf = 2*Bf;<br> | ||
+ | C = 2*C;<br> | ||
+ | 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,note_Bf,note_Df,note_C_half,note_G,note_Bf,note_C_dotted,note_Bf,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> |
− | 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');<br> | |
− | %Part 2 | + | %Part 2<br> |
− | [beatles, fs, bits] = wavread('Beatles.wav'); | + | [beatles, fs, bits] = wavread('Beatles.wav'); <br> |
− | sound(beatles, fs, bits); | + | sound(beatles, fs, bits);<br> |
− | reverse = flipud(beatles); | + | reverse = flipud(beatles);<br> |
− | sound(reverse,fs); | + | sound(reverse,fs);<br> |
− | wavwrite(reverse,fs,'Beatles_Reverse'); | + | 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. | ||
+ | |||
+ | [[Media:Normal.wav]]<br> | ||
+ | [[Media:Twice_Speed.wav]]<br> | ||
+ | [[Media:Higher_Pitch.wav]]<br> | ||
+ | [[Media:Beatles_Reverse.wav]]<br> |
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