MATLAB Code
%Max Paganini %mpaganin@purdue.edu %Hw1.2 Song Reversal clc; clear; %Open Judas Priest Song with Sample Rate (Fs) in Hz and number of bits per %sample (nbits). [y, Fs, nbits] = wavread('jpforward.wav'); disp('Sample Rate (Fs) in Hertz: ') disp(Fs) disp('Number of bits per sample (nbits): ') disp(nbits) %Check to see if file loaded correctly disp('Normal Song playing now.') wavplay(y,Fs); %Time to reverse the file time = size(y); last_n = time(1); reversed = zeros(last_n,1); counter = last_n; while(counter > 1) reversed(last_n - (counter-1),1) = y(counter); counter = counter - 1; end %Play reversed Judas Priest Song disp('Now the creepy part.') wavplay(reversed, Fs); disp('Did he just say "Suicide of the Mind"???') %Burn reversed Judas Priest song wavwrite(reversed,Fs,nbits,'jpreversed.wav'); %Half speed slow down of the reversed song disp('Lets listen to that in slow motion.') wavplay(reversed, Fs/1.75); disp('Now it sounds like the Devil is saying "Suicide of the Mind."') %Burn slowed down reversal wavwrite(reversed, Fs/1.75, nbits,'jpreversedslow.wav');