% Phase Vocoder Effects by John Arroyo, ja2124@columbia.edu
% Robot Effect example using the vocoding engine created

[signal,Sr] = wavread('ToneENG2FIRE.wav');

%1024 is good for this sample, a large or smaller one can be used depending
%on the Sr,
hannWindowLength = 1024;
timeScale = 1;

% Note: it is possible to timeStretch while creating the robot voice
signalRobot = robot(signal,timeScale,Sr);

%using 512 as the hanning window gives a nice effect
%signalRobot = robot(signal,timeScale,Sr,512);

%original sudio clip
wavplay(signal,Sr)

%time stretched signal
wavplay(signalRobot,Sr)

%wavwrite(signalRobot,Sr,16,'ToneENG2FIRE_robot_phaseConst.wav')

%used only during debugging
clear encode;
clear decode;
clear robot;