Revision as of 07:46, 19 January 2011 by Ssanthak (Talk | contribs)

Media:SmokeWaterSanthakumar.wav% Sachin Santhakumar
% ECE 301
% HW 01 Problem 01
% Playing Music
% 01/19/2011

clear;
clc;

% beats per second
bps = 112/60;
% seconds per beat
beat_time = bps^-1;

% Length of time for each entry in the sound array
delta = 0.00005;

% Note lengths
quarter = 0:delta:beat_time;
half = 0:delta:beat_time*2;
dotquart = 0:delta:beat_time*(3/2);
eighth = 0:delta:beat_time*(1/2);

% Note frequencies
freqG = 391.995;
freqBf = 466.164;
freqC = 523.251;
freqDf = 554.365;

% Construction of the signal of all the required notes
GQ = sin(2*pi*freqG*quarter);
BfQ = sin(2*pi*freqBf*quarter);
CDq = sin(2*pi*freqC*dotquart);
DfE = sin(2*pi*freqDf*eighth);
CH = sin(2*pi*freqC*half);
CDq = sin(2*pi*freqC*dotquart);
Erest = zeros((eighth/delta),1);
Hrest = zeros((half/delta),1);

% Signal for the song
X = [GQ,BfQ,CDq,GQ,BfQ,DfE,CH,GQ,BfQ,CDq,BfQ,GQ,Erest,Hrest];

% Plays wav file
wavplay(X,1/delta);
wavwrite(X,1/delta,32,'SmokeWaterSanthakumar');

% Plays wav file twice as fast
wavplay(X,(2/delta));
wavwrite(X,2/delta,32,'SmokeWater2xSpeedSanthakumar');

% Transformation of y(t) = x(2t);
GQ = sin(4*pi*freqG*quarter);
BfQ = sin(4*pi*freqBf*quarter);
CDq = sin(4*pi*freqC*dotquart);
DfE = sin(4*pi*freqDf*eighth);
CH = sin(4*pi*freqC*half);
CDq = sin(4*pi*freqC*dotquart);
Erest = zeros((2*eighth/delta),1);
Hrest = zeros((2*half/delta),1);

Y = [GQ,BfQ,CDq,GQ,BfQ,DfE,CH,GQ,BfQ,CDq,BfQ,GQ,Erest,Hrest];

% Plays modified wav file
wavplay(Y,1/delta);
wavwrite(X,1/delta,32,'SmokeWaterTransformedSanthakumar');

% Sachin Santhakumar
% ECE 301
% HW 01 Problem 02
% Hidden Backward Message
% 01/19/2011

clear;
clc;

% Reads in wav file
[Y, f] = wavread ('Beatles.wav');

Yrev = flipud (Y);
% Plays backwards wav file
wavplay(Yrev,f);

% Forwards the sound clip seems to say "Number Nine"
% Backwards the sound clip seems to say "Turn Me On Dead Man"

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett