(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Media:Normal_Song.wav]]
+
[[Media:Normal_Song.wav]]<br>
[[Media:Twice_as_fast.wav]]
+
[[Media:Twice_as_fast.wav]]<br>
%Megha Reddy
+
[[Media:Transformation_x(2t).wav]]<br>
%ECE 301
+
%Megha Reddy<br>
 +
%ECE 301<br>
 +
<br>
 +
clear <br>
 +
clc <br>
 +
%Part 1 <br>
 +
G_freq = 391.995;<br>
 +
Bflat_freq = 466.164;<br>
 +
C_freq = 523.251;<br>
 +
Dflat_freq = 544.365;<br>
 +
<br>
 +
bpm = 112; %number of beats per minute<br>
 +
beats_per_sec = bpm/60; %number of beats per second<br>
 +
rev_bps = 1/beats_per_sec; %calculates the time for each beat<br>
 +
<br>
 +
delta = 0.00005;<br>
 +
<br>
 +
Q = 0:delta:1*rev_bps; %duration of a quarter note<br>
 +
E = 0:delta:0.5*rev_bps; %duration of an eight note<br>
 +
H = 0:delta:2*rev_bps; %duration of a half note<br>
 +
DQ = 0:delta:1.5*rev_bps; %duration of a dotted quarter note<br>
 +
<br>
 +
G_Q = sin(2*pi*G_freq*Q); %calculates a G quarter note<br>
 +
Bflat_Q = sin(2*pi*Bflat_freq*Q); %calculates a B flat quarter note<br>
 +
Cdot = sin(2*pi*C_freq*DQ); %calculates a C dotted quarter note<br>
 +
Dflat_E = sin(2*pi*Dflat_freq*E); %calculates a D flat eighth note<br>
 +
C_H = sin(2*pi*C_freq*H); %calculates a C half note<br>
 +
rest_E = zeros(E/delta,1); %calculates an eighth rest<br>
 +
rest_H = zeros(H/delta,1); % calculates a half rest<br>
 +
<br>
 +
%puts the notes in an array to be able to play the song<br>
 +
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H]; <br>
 +
sound(song,1/delta); <br>
 +
<br>
 +
%plays song two times faster<br>
 +
sound(song,2/delta);<br>
 +
<br>
 +
%doubles the time interval for each  note <br>
 +
newQ = 2*Q;<br>
 +
newE = 2*E;<br>
 +
newH = 2*H;<br>
 +
newDQ = 2*DQ;<br>
 +
<br>
 +
G_Q = sin(2*pi*G_freq*newQ);<br>
 +
Bflat_Q = sin(2*pi*Bflat_freq*newQ);<br>
 +
Cdot = sin(2*pi*C_freq*newDQ);<br>
 +
Dflat_E = sin(2*pi*Dflat_freq*newE);<br>
 +
C_H = sin(2*pi*C_freq*newH);<br>
 +
rest_E = zeros(E/delta,1);<br>
 +
rest_H = zeros(H/delta,1);<br>
 +
<br>
 +
%plays the song with the new time interval<br>
 +
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H];<br>
 +
sound(song,1/delta);<br>
 +
<br>
 +
clear <br>
 +
clc<br>
  
clear
+
%Part 2<br>
clc
+
[song,Fs] = wavread('Beatles.wav'); %reads the given file and stores it in an array<br>
%Part 1
+
<br>
G_freq = 391.995;
+
song_rev = flipud(song); %flips the array<br>
Bflat_freq = 466.164;
+
<br>
C_freq = 523.251;
+
sound(song_rev,Fs); %plays the reversed song<br>
Dflat_freq = 544.365;
+
<br>
 
+
%The reverse song does contain it message, the words are not clear but it<br>
bpm = 112; %number of beats per minute
+
%sounds like it says "turn me on dead man"<br>
beats_per_sec = bpm/60; %number of beats per second
+
<br>
rev_bps = 1/beats_per_sec; %calculates the time for each beat
+
 
+
delta = 0.00005;
+
 
+
Q = 0:delta:1*rev_bps; %duration of a quarter note
+
E = 0:delta:0.5*rev_bps; %duration of an eight note
+
H = 0:delta:2*rev_bps; %duration of a half note
+
DQ = 0:delta:1.5*rev_bps; %duration of a dotted quarter note
+
 
+
G_Q = sin(2*pi*G_freq*Q); %calculates a G quarter note
+
Bflat_Q = sin(2*pi*Bflat_freq*Q); %calculates a B flat quarter note
+
Cdot = sin(2*pi*C_freq*DQ); %calculates a C dotted quarter note
+
Dflat_E = sin(2*pi*Dflat_freq*E); %calculates a D flat eighth note
+
C_H = sin(2*pi*C_freq*H); %calculates a C half note
+
rest_E = zeros(E/delta,1); %calculates an eighth rest
+
rest_H = zeros(H/delta,1); % calculates a half rest
+
 
+
%puts the notes in an array to be able to play the song
+
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H];
+
sound(song,1/delta);
+
 
+
%plays song two times faster
+
sound(song,2/delta);
+
 
+
%doubles the time interval for each  note
+
newQ = 2*Q;
+
newE = 2*E;
+
newH = 2*H;
+
newDQ = 2*DQ;
+
 
+
G_Q = sin(2*pi*G_freq*newQ);
+
Bflat_Q = sin(2*pi*Bflat_freq*newQ);
+
Cdot = sin(2*pi*C_freq*newDQ);
+
Dflat_E = sin(2*pi*Dflat_freq*newE);
+
C_H = sin(2*pi*C_freq*newH);
+
rest_E = zeros(E/delta,1);
+
rest_H = zeros(H/delta,1);
+
 
+
%plays the song with the new time interval
+
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H];
+
sound(song,1/delta);
+
 
+
clear
+
clc
+
 
+
%Part 2
+
[song,Fs] = wavread('Beatles.wav'); %reads the given file and stores it in an array
+
 
+
song_rev = flipud(song); %flips the array
+
 
+
sound(song_rev,Fs); %plays the reversed song
+
 
+
%The reverse song does contain it message, the words are not clear but it
+
%says "turn me on dead man"
+

Latest revision as of 07:48, 19 January 2011

Media:Normal_Song.wav
Media:Twice_as_fast.wav
Media:Transformation_x(2t).wav
%Megha Reddy
%ECE 301

clear
clc
%Part 1
G_freq = 391.995;
Bflat_freq = 466.164;
C_freq = 523.251;
Dflat_freq = 544.365;

bpm = 112; %number of beats per minute
beats_per_sec = bpm/60; %number of beats per second
rev_bps = 1/beats_per_sec; %calculates the time for each beat

delta = 0.00005;

Q = 0:delta:1*rev_bps; %duration of a quarter note
E = 0:delta:0.5*rev_bps; %duration of an eight note
H = 0:delta:2*rev_bps; %duration of a half note
DQ = 0:delta:1.5*rev_bps; %duration of a dotted quarter note

G_Q = sin(2*pi*G_freq*Q); %calculates a G quarter note
Bflat_Q = sin(2*pi*Bflat_freq*Q); %calculates a B flat quarter note
Cdot = sin(2*pi*C_freq*DQ); %calculates a C dotted quarter note
Dflat_E = sin(2*pi*Dflat_freq*E); %calculates a D flat eighth note
C_H = sin(2*pi*C_freq*H); %calculates a C half note
rest_E = zeros(E/delta,1); %calculates an eighth rest
rest_H = zeros(H/delta,1); % calculates a half rest

%puts the notes in an array to be able to play the song
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H];
sound(song,1/delta);

%plays song two times faster
sound(song,2/delta);

%doubles the time interval for each note
newQ = 2*Q;
newE = 2*E;
newH = 2*H;
newDQ = 2*DQ;

G_Q = sin(2*pi*G_freq*newQ);
Bflat_Q = sin(2*pi*Bflat_freq*newQ);
Cdot = sin(2*pi*C_freq*newDQ);
Dflat_E = sin(2*pi*Dflat_freq*newE);
C_H = sin(2*pi*C_freq*newH);
rest_E = zeros(E/delta,1);
rest_H = zeros(H/delta,1);

%plays the song with the new time interval
song = [G_Q,Bflat_Q,Cdot,G_Q,Bflat_Q,Dflat_E,C_H,G_Q,Bflat_Q,Cdot,Bflat_Q,G_Q,rest_E,rest_H];
sound(song,1/delta);

clear
clc

%Part 2
[song,Fs] = wavread('Beatles.wav'); %reads the given file and stores it in an array

song_rev = flipud(song); %flips the array

sound(song_rev,Fs); %plays the reversed song

%The reverse song does contain it message, the words are not clear but it
%sounds like it says "turn me on dead man"

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood