(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;...) |
|||
Line 1: | Line 1: | ||
%Daniel Sabo | %Daniel Sabo | ||
− | %ECE 301 | + | %ECE 301 |
− | %HW 1 | + | %HW 1 |
%Part 1 | %Part 1 | ||
− | delta = .00005 | + | delta = .00005; |
− | + | ||
− | + | bps = 112/60; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | G = 391.995; | + | whole = 0:delta:bps; |
− | Bf = 466.164; | + | half = 0:delta:bps/2; |
− | C = 523.251; | + | 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; | Df = 554.365; | ||
− | note_G = sin(2*pi*G*quarter); | + | note_G = sin(2*pi*G*quarter); |
− | note_Bf = sin(2*pi*Bf*quarter); | + | note_Bf = sin(2*pi*Bf*quarter); |
− | note_C_dotted = sin(2*pi*C*dotted_q); | + | note_C_dotted = sin(2*pi*C*dotted_q); |
note_C_half = sin(2*pi*C*half); | note_C_half = sin(2*pi*C*half); | ||
− | note_Df = sin(2*pi*Df*eigth); | + | note_Df = sin(2*pi*Df*eigth); |
− | normal = [note_G,note_Bf,note_C_dotted,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]; |
− | + | ||
− | + | ||
− | bps = bps/2; | + | bps = bps/2; |
− | whole = 0:delta:bps; | + | whole = 0:delta:bps; |
− | half = 0:delta:bps/2; | + | half = 0:delta:bps/2; |
− | quarter = 0:delta:bps/4; | + | quarter = 0:delta:bps/4; |
− | eigth = 0:delta:bps/8; | + | eigth = 0:delta:bps/8; |
− | dotted_q = 0:delta:bps*.375; | + | dotted_q = 0:delta:bps*.375; |
− | note_G = sin(2*pi*G*quarter); | + | note_G = sin(2*pi*G*quarter); |
− | note_Bf = sin(2*pi*Bf*quarter); | + | note_Bf = sin(2*pi*Bf*quarter); |
− | note_C_dotted = sin(2*pi*C*dotted_q); | + | note_C_dotted = sin(2*pi*C*dotted_q); |
note_C_half = sin(2*pi*C*half); | note_C_half = sin(2*pi*C*half); | ||
− | note_Df = sin(2*pi*Df*eigth); | + | note_Df = sin(2*pi*Df*eigth); |
− | 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]; |
− | + | ||
− | + | ||
− | whole = 0:delta:bps; | + | whole = 0:delta:bps; |
− | half = 0:delta:bps/2; | + | half = 0:delta:bps/2; |
− | quarter = 0:delta:bps/4; | + | quarter = 0:delta:bps/4; |
− | eigth = 0:delta:bps/8; | + | eigth = 0:delta:bps/8; |
− | dotted_q = 0:delta:bps*.375; | + | dotted_q = 0:delta:bps*.375; |
− | G = 2*G; | + | G = 2*G; Bf = 2*Bf; C = 2*C; Df = 2*Df; |
− | Bf = 2*Bf; | + | |
− | C = 2*C; | + | |
− | Df = 2*Df; | + | |
− | note_G = sin(2*pi*G*quarter); | + | note_G = sin(2*pi*G*quarter); |
− | note_Bf = sin(2*pi*Bf*quarter); | + | note_Bf = sin(2*pi*Bf*quarter); |
note_C_dotted = sin(2*pi*C*dotted_q); | note_C_dotted = sin(2*pi*C*dotted_q); | ||
note_C_half = sin(2*pi*C*half); | note_C_half = sin(2*pi*C*half); | ||
− | note_Df = sin(2*pi*Df*eigth); | + | note_Df = sin(2*pi*Df*eigth); |
− | 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]; |
− | + | ||
− | + | ||
− | wavwrite(normal, 1/delta,'Normal'); | + | wavwrite(normal, 1/delta,'Normal'); |
wavwrite(faster, 1/delta,'Twice_Speed'); | wavwrite(faster, 1/delta,'Twice_Speed'); | ||
− | wavwrite(higher, 1/delta,'Higher_Pitch'); | + | wavwrite(higher, 1/delta,'Higher_Pitch'); |
− | %Part 2 | + | %Part 2 |
− | [beatles, fs, bits] = wavread('Beatles.wav'); | + | [beatles, fs, bits] = wavread('Beatles.wav'); |
− | sound(beatles, fs, bits); | + | sound(beatles, fs, bits); |
− | reverse = flipud(beatles); | + | reverse = flipud(beatles); |
− | sound(reverse,fs); | + | sound(reverse,fs); |
wavwrite(reverse,fs,'Beatles_Reverse'); | wavwrite(reverse,fs,'Beatles_Reverse'); |
Revision as of 12:53, 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');