Revision as of 09:55, 13 January 2011 by Zgraber (Talk | contribs)

%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"

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics