(Removing all content from page) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Sound file [[Image:Example_ECE301Fall2008mboutin.jpg]] | ||
+ | == MATLAB code == | ||
+ | |||
+ | <pre> | ||
+ | % Ben Laskowski (blaskows@purdue.edu) | ||
+ | % September 5, 2008 | ||
+ | % ECE301 Section 2 HW1 | ||
+ | % | ||
+ | % This file is supposed to reverse and slow a wav file for extraction of | ||
+ | % alleged subliminal messages. | ||
+ | |||
+ | % Begin by clearing the output console and all memory. | ||
+ | clear; | ||
+ | clc; | ||
+ | |||
+ | %Open the wave file and get its length, sample size, and sampling rate | ||
+ | [data,fs,nbits]=wavread('jpforward.wav'); | ||
+ | |||
+ | %Play the file once normally | ||
+ | disp('Playing the unaltered file...') | ||
+ | wavplay(data,fs); | ||
+ | |||
+ | %Reverse the file, play it, and write it out | ||
+ | Length=size(data); | ||
+ | MaxCount=Length(1); | ||
+ | reversedata=zeros(MaxCount,1); | ||
+ | for counter=MaxCount:-1:1 | ||
+ | reversedata(MaxCount-counter+1,1)=data(counter); | ||
+ | end | ||
+ | disp('Playing reverse at normal speed...'); | ||
+ | wavplay(reversedata,fs); | ||
+ | |||
+ | |||
+ | %To slow the original data, we can just write out the reversed data with | ||
+ | % a fraction of the correct sampling rate. | ||
+ | disp('Playing reverse at 67% speed...'); | ||
+ | wavwrite(reversedata,fs/1.5,nbits,'jpreverseslow.wav'); | ||
+ | wavplay(reversedata,fs/1.5); | ||
+ | |||
+ | </pre> |
Latest revision as of 11:40, 2 September 2008
MATLAB code
% Ben Laskowski (blaskows@purdue.edu) % September 5, 2008 % ECE301 Section 2 HW1 % % This file is supposed to reverse and slow a wav file for extraction of % alleged subliminal messages. % Begin by clearing the output console and all memory. clear; clc; %Open the wave file and get its length, sample size, and sampling rate [data,fs,nbits]=wavread('jpforward.wav'); %Play the file once normally disp('Playing the unaltered file...') wavplay(data,fs); %Reverse the file, play it, and write it out Length=size(data); MaxCount=Length(1); reversedata=zeros(MaxCount,1); for counter=MaxCount:-1:1 reversedata(MaxCount-counter+1,1)=data(counter); end disp('Playing reverse at normal speed...'); wavplay(reversedata,fs); %To slow the original data, we can just write out the reversed data with % a fraction of the correct sampling rate. disp('Playing reverse at 67% speed...'); wavwrite(reversedata,fs/1.5,nbits,'jpreverseslow.wav'); wavplay(reversedata,fs/1.5);