clear all; s = wavread('sentence.wav'); fs = 16000; % EXPANSION RATE b=input('Enter the Required Percentage of Speed Increase\n'); % CHOOSING THE WINDOW LENGTH winLen = 30 * 16; l = length(s); s = s'; % DETERMINING THE NO.OF SAMPLES TO BE SHIFTED shiftSamples = winLen*(b/2) / 100; %LENGTH OF THE FINAL SENTENCE e= ceil(l*(1+b/100))+ ceil(l/winLen)+ 5000; s3 = zeros(1,e); j1 = ceil(winLen/2); m=1; tic for a = 1 : ceil(winLen/2) : (length(s)-winLen) %To Find The Optimum Shift for i = 1 : winLen Ms(1,i) = s(1,i+a-1); end n=0; if (shiftSamples+30 > winLen) temp = winLen; else temp = shiftSamples+30; end if (shiftSamples-30 < 0) temp1 = 1; else temp1 = shiftSamples-30; end for j = temp1 : temp n = n + 1; MSE(n) = 0; for i = j+1 : winLen MSE(n) = MSE(n) + (Ms(1,i) - Ms(1,(i-j)))^2; end MSE(n) = MSE(n)/(winLen - j+1); end [Y,I] = min(MSE); optShift = shiftSamples - (ceil(n/2) - I); % TIME SHIFTING AND ADDING A WINDOW ONTO ITSELF s1 = zeros(1,(winLen+optShift)); for i = 1 : winLen s1(1,i) = s(1,i+a-1); end for i = 1 : (optShift+winLen) if i <= optShift s2(1,i) = s1(1,i); else s2(1,i) = s1(1,i) + s1(1,i-optShift); end end %CREATING THE FINAL SENTENCE j1 = j1 - ceil(winLen/2); for i = 1 : (winLen+optShift) j1=j1+1; s3(1,j1) = s3(1,j1) + s2(1,i); end end j1 t=toc figure(1); subplot(2,1,1); plot(s); subplot(2,1,2); plot(s3);