(New page: % 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 e...) |
|||
Line 1: | Line 1: | ||
− | % Sachin Santhakumar | + | % Sachin Santhakumar<br>% ECE 301<br>% HW 01 Problem 01<br>% Playing Music<br>% 01/19/2011 |
− | % ECE 301 | + | |
− | % HW 01 Problem 01 | + | |
− | % Playing Music | + | |
− | % 01/19/2011 | + | |
− | clear; | + | clear;<br>clc; |
− | clc; | + | |
− | % beats per second | + | % beats per second<br>bps = 112/60;<br>% seconds per beat<br>beat_time = bps^-1; |
− | bps = 112/60; | + | |
− | % seconds per beat | + | |
− | beat_time = bps^-1; | + | |
− | % Length of time for each entry in the sound array | + | % Length of time for each entry in the sound array<br>delta = 0.00005; |
− | delta = 0.00005; | + | |
− | % Note lengths | + | % Note lengths<br>quarter = 0:delta:beat_time;<br>half = 0:delta:beat_time*2;<br>dotquart = 0:delta:beat_time*(3/2);<br>eighth = 0:delta:beat_time*(1/2); |
− | 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 | + | % Note frequencies<br>freqG = 391.995;<br>freqBf = 466.164;<br>freqC = 523.251;<br>freqDf = 554.365; |
− | freqG = 391.995; | + | |
− | freqBf = 466.164; | + | |
− | freqC = 523.251; | + | |
− | freqDf = 554.365; | + | |
− | % Construction of the signal of all the required notes | + | % Construction of the signal of all the required notes<br>GQ = sin(2*pi*freqG*quarter);<br>BfQ = sin(2*pi*freqBf*quarter);<br>CDq = sin(2*pi*freqC*dotquart);<br>DfE = sin(2*pi*freqDf*eighth);<br>CH = sin(2*pi*freqC*half);<br>CDq = sin(2*pi*freqC*dotquart);<br>Erest = zeros((eighth/delta),1);<br>Hrest = zeros((half/delta),1); |
− | 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 | + | % Signal for the song<br>X = [GQ,BfQ,CDq,GQ,BfQ,DfE,CH,GQ,BfQ,CDq,BfQ,GQ,Erest,Hrest]; |
− | X = [GQ,BfQ,CDq,GQ,BfQ,DfE,CH,GQ,BfQ,CDq,BfQ,GQ,Erest,Hrest]; | + | |
− | % Plays wav file | + | % Plays wav file<br>wavplay(X,1/delta);<br>wavwrite(X,1/delta,32,'SmokeWaterSanthakumar'); |
− | wavplay(X,1/delta); | + | |
− | % Plays wav file twice as fast | + | % Plays wav file twice as fast<br>wavplay(X,(2/delta));<br>wavwrite(X,2/delta,32,'SmokeWater2xSpeedSanthakumar'); |
− | wavplay(X,(2/delta)); | + | |
− | % Transformation of y(t) = x(2t); | + | % Transformation of y(t) = x(2t);<br>GQ = sin(4*pi*freqG*quarter);<br>BfQ = sin(4*pi*freqBf*quarter);<br>CDq = sin(4*pi*freqC*dotquart);<br>DfE = sin(4*pi*freqDf*eighth);<br>CH = sin(4*pi*freqC*half);<br>CDq = sin(4*pi*freqC*dotquart);<br>Erest = zeros((2*eighth/delta),1);<br>Hrest = zeros((2*half/delta),1); |
− | 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]; | Y = [GQ,BfQ,CDq,GQ,BfQ,DfE,CH,GQ,BfQ,CDq,BfQ,GQ,Erest,Hrest]; | ||
− | % Plays modified wav file | + | % Plays modified wav file<br>wavplay(Y,1/delta);<br>wavwrite(X,1/delta,32,'SmokeWaterTransformedSanthakumar'); |
− | wavplay(Y,1/delta); | + | |
− | % Sachin Santhakumar | + | % Sachin Santhakumar<br>% ECE 301<br>% HW 01 Problem 02<br>% Hidden Backward Message<br>% 01/19/2011 |
− | % ECE 301 | + | |
− | % HW 01 Problem 02 | + | |
− | % Hidden Backward Message | + | |
− | % 01/19/2011 | + | |
− | clear; | + | clear;<br>clc; |
− | clc; | + | |
− | % Reads in wav file | + | % Reads in wav file<br>[Y, f] = wavread ('Beatles.wav'); |
− | [Y, f] = wavread | + | |
− | Yrev = flipud (Y); | + | Yrev = flipud (Y);<br>% Plays backwards wav file<br>wavplay(Yrev,f); |
− | % Plays backwards wav file | + | |
− | wavplay(Yrev,f); | + | |
− | % Forwards the sound clip seems to say "Number Nine" | + | % Forwards the sound clip seems to say "Number Nine"<br>% Backwards the sound clip seems to say "Turn Me On Dead Man"<br> |
− | % Backwards the sound clip seems to say "Turn Me On Dead Man" | + |
Revision as of 07:45, 19 January 2011
% 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"