(New page: %Cory Ocker (cocker@purdue.edu) %9/5/08 HW1 %EE301 MWF 4:30 clear; clc; %first i went to http://www.hoerl.com/Music/music1_basic.html and read a %tutorial on music because I don't know di...)
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
It sounds like "I took my own life"...
 +
[[Media:jpbackwards_ECE301Fall2008mboutin.wav]]
 +
<pre>
 
%Cory Ocker (cocker@purdue.edu)
 
%Cory Ocker (cocker@purdue.edu)
 
%9/5/08 HW1
 
%9/5/08 HW1
Line 5: Line 8:
 
clc;
 
clc;
  
%first i went to http://www.hoerl.com/Music/music1_basic.html and read a
 
%tutorial on music because I don't know diddly about music notes
 
  
%define notes using
+
jp='./jpforward.wav'; %call file
%http://www.techlib.com/reference/musical_note_frequencies.htm
+
[forward,sample_rate,bits_per_sample]=wavread(jp); %reads the file
A =220;
+
backward=flipud(forward); %flips the file
B =246.94;
+
slowspeed=sample_rate/1.7; %used to slowdown the sound in reverse
C =261.64;
+
wavplay(forward,sample_rate); %plays the file forward
Db =277.20;
+
wavplay(backward,slowspeed); %plays the file backwards
D =293.68;
+
wavwrite(backward,slowspeed,'jpbackwards.wav'); %writes the file as a wav
E =329.64;
+
</pre>
F =349.24;
+
Gb =370;
+
G =392;
+
 
+
%define delta
+
delta =1/20000;
+
 
+
%define beats (can range from 40 bpm to 200 bpm)
+
e =.25;
+
q =.5;
+
dq =.75;
+
h =1;
+
dh =1.5;
+
w =2;
+
 
+
%timings for notes
+
lengths =[h,q,q,dq,e,q,q,q,e,e,q,e,e,dh,h,q,q,dq,e,q,q,q,e,e,q,e,e,w,dq,e,...
+
    q,q,dq,e,q,e,e,q,q,q,q,w,dq,e,q,q,q,q,q,q,dq,e,dq,e,w,w];
+
%notes for song
+
notes =[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb,Gb,Gb,E,D,E,Gb,Gb,E,B,Db,D,Db,B,E,...
+
    A,A,B,Db,D,E,Gb,Gb,Gb,G,G,D,E,Gb,B,Db,D,B,A,D,Gb,A,B,Gb,E,D,D];
+
 
+
 
+
%regular speed
+
for lcv =1:length(notes)
+
t =0:delta:lengths(lcv);
+
wave =sin(2*pi*t*notes(lcv));
+
sound(wave,1/delta);
+
end
+
 
+
 
+
pause(5)
+
 
+
%double speed
+
for lcv =1:length(notes)
+
t =0:delta:1/2*lengths(lcv);  
+
wave =sin(2*pi*t*notes(lcv));
+
sound(wave,1/delta);
+
end
+
 
+
pause(5)
+
 
+
%3/4 speed (sounds the best to me after testing)
+
for lcv =1:length(notes)
+
t =0:delta:3/4*lengths(lcv);
+
wave =sin(2*pi*t*notes(lcv));
+
sound(wave,1/delta);
+
end
+
 
+
pause(5)
+
 
+
%doubles the frequencies
+
for lcv =1:length(notes)
+
t =0:delta:lengths(lcv);
+
wave =sin(2*2*pi*t*notes(lcv));
+
sound(wave,1/delta);
+
end
+

Latest revision as of 11:57, 4 September 2008

It sounds like "I took my own life"... Media:jpbackwards_ECE301Fall2008mboutin.wav

%Cory Ocker (cocker@purdue.edu)
%9/5/08 HW1
%EE301 MWF 4:30
clear;
clc;


jp='./jpforward.wav'; %call file
[forward,sample_rate,bits_per_sample]=wavread(jp); %reads the file 
backward=flipud(forward); %flips the file
slowspeed=sample_rate/1.7; %used to slowdown the sound in reverse
wavplay(forward,sample_rate); %plays the file forward
wavplay(backward,slowspeed); %plays the file backwards
wavwrite(backward,slowspeed,'jpbackwards.wav'); %writes the file as a wav

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009