(MATLAB Code)
(MATLAB Code)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
I honestly can't hear the lyrics forwards are backwards, i think people read more into this than there is :)
 +
 +
== JP Files ==
 +
[[Media:jpreverse_ECE301Fall2008mboutin.ogg]]
 +
 +
[[Media:jpreverseslowed_ECE301Fall2008mboutin.ogg]]
 +
 
== MATLAB Code ==
 
== MATLAB Code ==
 
<pre>
 
<pre>
Line 17: Line 24:
 
wavplay(data,sample);
 
wavplay(data,sample);
  
%Reverses the data, plays it, then saves it to a file
+
%Creates an array for reversing the data and then reverses it
 
Length_Array=size(data);
 
Length_Array=size(data);
 
Length=Length_Array(1);
 
Length=Length_Array(1);
Line 24: Line 31:
 
     data_reverse(Length-j+1,1)=data(j);
 
     data_reverse(Length-j+1,1)=data(j);
 
end
 
end
 +
%Plays the song and saves it to a file
 
wavplay(data_reverse,sample);
 
wavplay(data_reverse,sample);
 
wavwrite(data_reverse,sample,rate,'jpreverse.wav');
 
wavwrite(data_reverse,sample,rate,'jpreverse.wav');
  
%To slow the original data, we can just write out the reversed data with
+
%Now to slow the song down
% a fraction of the correct sampling rate.
+
%To do this all you do is lower the sample rate
wavwrite(reversedata,sample/1.5,rate,'jpreverseslow.wav');
+
%Perhaps twice as slow?
wavplay(reversedata,sample/1.5);
+
slowsample = sample/2;
 +
wavplay(reversedata,slowsample);
 +
wavwrite(reversedata,slowsample,rate,'jpreverseslowed.wav');
 +
 
 
</pre>
 
</pre>

Latest revision as of 19:52, 4 September 2008

I honestly can't hear the lyrics forwards are backwards, i think people read more into this than there is :)

JP Files

Media:jpreverse_ECE301Fall2008mboutin.ogg

Media:jpreverseslowed_ECE301Fall2008mboutin.ogg

MATLAB Code

% Travis Safford
% September 5, 2008
%
% Homework 1.2 - This file is supposed to reverse and slow down a Judas Priest song

% Begin by clearing the console and all saved memory.
clear;
clc;

%Open the wave file and get its length, sample size, and sampling rate
%Make sure the file is in your present working directory for matlab
[data,sample,rate]=wavread('jpforward.wav');

%Play the file once at normal speed
wavplay(data,sample);

%Creates an array for reversing the data and then reverses it
Length_Array=size(data);
Length=Length_Array(1);
data_reverse=zeros(Length,1);
for j=Length:-1:1
    data_reverse(Length-j+1,1)=data(j);
end
%Plays the song and saves it to a file
wavplay(data_reverse,sample);
wavwrite(data_reverse,sample,rate,'jpreverse.wav');

%Now to slow the song down
%To do this all you do is lower the sample rate
%Perhaps twice as slow?
slowsample = sample/2;
wavplay(reversedata,slowsample);
wavwrite(reversedata,slowsample,rate,'jpreverseslowed.wav');

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett