(New page: %Sourabh Ranka %email== sranka@purdue.edu %ece 301 %to clear data clear; clc; %using the waveread command to convert the .wav file to the digital signal 'song' [song, samplerate, bi...)
 
Line 1: Line 1:
 +
<pre>
 
%Sourabh Ranka
 
%Sourabh Ranka
 
 
%email== sranka@purdue.edu
 
%email== sranka@purdue.edu
 
 
%ece 301
 
%ece 301
  
 
%to clear data
 
%to clear data
 
 
clear;
 
clear;
 
 
clc;
 
clc;
  
 
%using the waveread command to convert the .wav file to the digital signal 'song'
 
%using the waveread command to convert the .wav file to the digital signal 'song'
 
 
[song, samplerate, bitspersample] = wavread('H:\pu.data\Desktop\Jpforward.wav');
 
[song, samplerate, bitspersample] = wavread('H:\pu.data\Desktop\Jpforward.wav');
  
 
%using the waveplay command to listen the digital signal we have just converted at 44100 hz sampling rate
 
%using the waveplay command to listen the digital signal we have just converted at 44100 hz sampling rate
 
 
wavplay(song, samplerate);
 
wavplay(song, samplerate);
  
 
songback = flipud(song);
 
songback = flipud(song);
 
 
%to play the file backwardwe use the waveplay command and it runs it at the same frequency as the original sample rate   
 
%to play the file backwardwe use the waveplay command and it runs it at the same frequency as the original sample rate   
 
 
wavplay(songback, samplerate);
 
wavplay(songback, samplerate);
  
 
%to play  the song at half the sample rate
 
%to play  the song at half the sample rate
 
 
wavplay (songback,samplerate*0.5);
 
wavplay (songback,samplerate*0.5);
  
 
% to write the program on wave file
 
% to write the program on wave file
 
 
wavwrite(song,samplerate,bitspersample,'H:\pu.data\Desktop\songforward.wav');
 
wavwrite(song,samplerate,bitspersample,'H:\pu.data\Desktop\songforward.wav');
 
 
wavwrite(songback,samplerate,bitspersample,'H:\pu.data\Desktop\songbackward.wav');
 
wavwrite(songback,samplerate,bitspersample,'H:\pu.data\Desktop\songbackward.wav');
 
 
wavwrite(songback,samplerate*0.5,bitspersample,'H:\pu.data\Desktop\songslow.wav');
 
wavwrite(songback,samplerate*0.5,bitspersample,'H:\pu.data\Desktop\songslow.wav');
 +
</pre>

Revision as of 13:10, 5 September 2008

%Sourabh Ranka
%email== sranka@purdue.edu
%ece 301

%to clear data
clear;
clc;

%using the waveread command to convert the .wav file to the digital signal 'song'
[song, samplerate, bitspersample] = wavread('H:\pu.data\Desktop\Jpforward.wav');

%using the waveplay command to listen the digital signal we have just converted at 44100 hz sampling rate
wavplay(song, samplerate);

songback = flipud(song);
%to play the file backwardwe use the waveplay command and it runs it at the same frequency as the original sample rate  
wavplay(songback, samplerate);

%to play  the song at half the sample rate
wavplay (songback,samplerate*0.5);

% to write the program on wave file
wavwrite(song,samplerate,bitspersample,'H:\pu.data\Desktop\songforward.wav');
wavwrite(songback,samplerate,bitspersample,'H:\pu.data\Desktop\songbackward.wav');
wavwrite(songback,samplerate*0.5,bitspersample,'H:\pu.data\Desktop\songslow.wav');

Alumni Liaison

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

Dr. Paul Garrett