function y= stpt(x,w,N,H,t)
M=length(w);                                  % Window size
pin=0;                                        % Start pointer
pend=length(x)-M;                             % End pointer
y=zeros(1,length(x));                         % Inicial. output
npeaks=0;                                     % Number of peaks
w=w./sum(w);                                  % Analy. Windw. Norm.
w_out=hanning(M)';                            % Synthesis window.
w_out=w_out./sum(w_out);                      % Synth. Windw. Norm.
while(pin<pend)                               % Until the end...
  %---Analysis
  x_w=x(pin+1:pin+M).*w(1:M);                 % Windowing signal
  fftbuffer=[x_w, zeros(1,N-M)];              % Zero-padding
  fftbuffer=circshift(fftbuffer,[0,-(M-1)/2]);% Zero-phase shift
  X=fft(fftbuffer,N);                         % FFT
  Xmag=20*log10(abs(X(1:N/2+1)));             % Magnitude in dBs
  Xphase=unwrap(angle(X(1:N/2+1)));           % Phase
  %---Transformation Xmag and Xphase
  ploc = 1+find((Xmag(2:N/2)>t).*(Xmag(2:N/2)>Xmag(3:N/2+1)).*(Xmag(2:N/2)>Xmag(1:N/2-1)));      % Find the local max.
  npeaks=npeaks+length(ploc);
  pphase=Xphase(ploc);                        % Save phase values
  pmag=Xmag(ploc);                            % Save mag. values
  %plot_peaks(Xmag,Xphase,ploc,t);            % Plotting peaks
  Xmag=zeros(1,N/2+1)-1000;                   % Modifying Xmag...
  Xphase=zeros(1,N/2+1);                      % Modifying Xphase...
  %ploc=round(ploc.*0.96);                    % Transposition    (fx)
  %ploc=10:10:10*length(ploc);                % Harmonics mapping(fx)
  Xmag(ploc)=pmag;                            % Add the mag maxs.
  Xphase(ploc)=pphase;                        % Add the phase maxs.
  %---Synthesis
  Y(1:N/2+1) = 10.^(Xmag/20).*exp(1i.*Xphase);% Generate posit. freq.
  Y(N/2+2:N) = conj(fliplr(Y(2:N/2)));        % Generate negat. freq                        
  fftbuffer_out=real(ifft(Y));                % Clean the signal
  fftbuffer_out=circshift(fftbuffer_out,[0,+(M-1)/2]); 
                                              % Undo zero-phasing
  y(pin+1:pin+M)=y(pin+1:pin+M)+H*N*fftbuffer_out(1:M).*w_out;
                                              % Overlap-add method
  pin=pin+H;                                  % Advance pointer
end