(New page: %Zachary J. Graber<br>%ECE 301 HW1 %PART 1 clear<br>clc<br>delta = 0.00005;<br>whl = 112/60; %whole note length %normal play<br>th = 0:delta:(whl/2);<br>tq = 0:delta:(whl/4);<br>te = 0:...) |
|||
Line 1: | Line 1: | ||
− | %Zachary J. Graber<br>%ECE 301 HW1 | + | %Zachary J. Graber<br>%ECE 301 HW1 |
− | %PART 1 | + | %PART 1 |
− | clear<br>clc<br>delta = 0.00005;<br>whl = 112/60; %whole note length | + | clear<br>clc<br>delta = 0.00005;<br>whl = 112/60; %whole note length |
− | %normal play<br>th = 0:delta:(whl/2);<br>tq = 0:delta:(whl/4);<br>te = 0:delta:(whl/8);<br>tdq = 0:delta:(whl/4+whl/8);<br>n = zeros(1,(whl/8)/delta);%blank space at end of melodies | + | %normal play<br>th = 0:delta:(whl/2);<br>tq = 0:delta:(whl/4);<br>te = 0:delta:(whl/8);<br>tdq = 0:delta:(whl/4+whl/8);<br>n = zeros(1,(whl/8)/delta);%blank space at end of melodies |
− | g = sin(2*pi*392*tq);<br>bflat = sin(2*pi*466.16*tq);<br>c = sin(2*pi*523.25*tdq);<br>dflat = sin(2*pi*554.37*te);<br>chalf = sin(2*pi*523.25*th); | + | g = sin(2*pi*392*tq);<br>bflat = sin(2*pi*466.16*tq);<br>c = sin(2*pi*523.25*tdq);<br>dflat = sin(2*pi*554.37*te);<br>chalf = sin(2*pi*523.25*th); |
− | part1 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; | + | part1 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; |
− | %double speed<br>th = 0:delta:(whl/4);<br>tq = 0:delta:(whl/8);<br>te = 0:delta:(whl/16);<br>tdq = 0:delta:(whl/4+whl/8)/2;<br>g = sin(2*pi*392*tq);<br>bflat = sin(2*pi*466.16*tq);<br>c = sin(2*pi*523.25*tdq);<br>dflat = sin(2*pi*554.37*te);<br>chalf = sin(2*pi*523.25*th); | + | %double speed<br>th = 0:delta:(whl/4);<br>tq = 0:delta:(whl/8);<br>te = 0:delta:(whl/16);<br>tdq = 0:delta:(whl/4+whl/8)/2;<br>g = sin(2*pi*392*tq);<br>bflat = sin(2*pi*466.16*tq);<br>c = sin(2*pi*523.25*tdq);<br>dflat = sin(2*pi*554.37*te);<br>chalf = sin(2*pi*523.25*th); |
− | part2 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; | + | part2 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; |
− | %higher pitch<br>th = 0:delta:(whl/2);<br>tq = 0:delta:(whl/4);<br>te = 0:delta:(whl/8);<br>tdq = 0:delta:(whl/4+whl/8); | + | %higher pitch<br>th = 0:delta:(whl/2);<br>tq = 0:delta:(whl/4);<br>te = 0:delta:(whl/8);<br>tdq = 0:delta:(whl/4+whl/8); |
− | g = sin(4*pi*392*tq);<br>bflat = sin(4*pi*466.16*tq);<br>c = sin(4*pi*523.25*tdq);<br>dflat = sin(4*pi*554.37*te);<br>chalf = sin(4*pi*523.25*th); | + | g = sin(4*pi*392*tq);<br>bflat = sin(4*pi*466.16*tq);<br>c = sin(4*pi*523.25*tdq);<br>dflat = sin(4*pi*554.37*te);<br>chalf = sin(4*pi*523.25*th); |
− | part3 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; | + | part3 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n]; |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | song = [part1, part2, part3];<br>wavwrite(song,1/delta,'smoke_on_the_water'); | ||
+ | %PART2<br>[beatles, fs] = wavread('Beatles.wav');<br>reverse = flipud(beatles);<br>wavwrite(reverse,fs,'beatles_message')<br><br> | ||
+ | <br> | ||
+ | <br> | ||
%To me the reverse sounds like "Let me on dead man" or "Turn me on dead man" | %To me the reverse sounds like "Let me on dead man" or "Turn me on dead man" |
Revision as of 09:55, 13 January 2011
%Zachary J. Graber
%ECE 301 HW1
%PART 1
clear
clc
delta = 0.00005;
whl = 112/60; %whole note length
%normal play
th = 0:delta:(whl/2);
tq = 0:delta:(whl/4);
te = 0:delta:(whl/8);
tdq = 0:delta:(whl/4+whl/8);
n = zeros(1,(whl/8)/delta);%blank space at end of melodies
g = sin(2*pi*392*tq);
bflat = sin(2*pi*466.16*tq);
c = sin(2*pi*523.25*tdq);
dflat = sin(2*pi*554.37*te);
chalf = sin(2*pi*523.25*th);
part1 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n];
%double speed
th = 0:delta:(whl/4);
tq = 0:delta:(whl/8);
te = 0:delta:(whl/16);
tdq = 0:delta:(whl/4+whl/8)/2;
g = sin(2*pi*392*tq);
bflat = sin(2*pi*466.16*tq);
c = sin(2*pi*523.25*tdq);
dflat = sin(2*pi*554.37*te);
chalf = sin(2*pi*523.25*th);
part2 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n];
%higher pitch
th = 0:delta:(whl/2);
tq = 0:delta:(whl/4);
te = 0:delta:(whl/8);
tdq = 0:delta:(whl/4+whl/8);
g = sin(4*pi*392*tq);
bflat = sin(4*pi*466.16*tq);
c = sin(4*pi*523.25*tdq);
dflat = sin(4*pi*554.37*te);
chalf = sin(4*pi*523.25*th);
part3 = [g,bflat,c,g,bflat,dflat,chalf,g,bflat,c,bflat,g,n];
song = [part1, part2, part3];
wavwrite(song,1/delta,'smoke_on_the_water');
%PART2
[beatles, fs] = wavread('Beatles.wav');
reverse = flipud(beatles);
wavwrite(reverse,fs,'beatles_message')
%To me the reverse sounds like "Let me on dead man" or "Turn me on dead man"