emmanouil@5: %function [y,yh,ys,fr0] = wave2fft2wave(x,fs,w,N,t,nH,minf0,maxf0,f0et,maxhd,stocf) emmanouil@5: function [y] = wave2fft2wave(x,w,N) emmanouil@5: %e.g. y = wave2fft2wave(x,hamming(2025),4096); emmanouil@5: emmanouil@5: emmanouil@5: M = length(w); % analysis window size emmanouil@5: Ns = 1024; % FFT size for synthesis emmanouil@5: H = 256; % hop size for analysis and synthesis emmanouil@5: soundlength = length(x); % length of input sound array emmanouil@5: hNs = Ns/2; % half synthesis window size emmanouil@5: hM = (M-1)/2; % half analysis window size emmanouil@5: pin = max(hNs+1,1+hM); % initialize sound pointer to middle of analysis window emmanouil@5: pend = soundlength-max(hM,hNs); % last sample to start a frame emmanouil@5: fftbuffer = zeros(N,1); % initialize buffer for FFT emmanouil@5: y = zeros(soundlength+Ns/2,1); % output sine component emmanouil@5: w = w/sum(w); % normalize analysis window emmanouil@5: sw = zeros(Ns,1); emmanouil@5: ow = triang(2*H-1); % overlapping window emmanouil@5: ovidx = Ns/2+1-H+1:Ns/2+H; % overlap indexes emmanouil@5: sw(ovidx) = ow(1:2*H-1); emmanouil@5: bh = blackmanharris(Ns); % synthesis window emmanouil@5: bh = bh ./ sum(bh); % normalize synthesis window emmanouil@5: sw(ovidx) = sw(ovidx) ./ bh(ovidx); emmanouil@5: emmanouil@5: emmanouil@5: while pin