Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About v_overlapadd #2

Open
QiangJI123 opened this issue Jul 31, 2019 · 2 comments
Open

About v_overlapadd #2

QiangJI123 opened this issue Jul 31, 2019 · 2 comments

Comments

@QiangJI123
Copy link

Hello, when applying this function, we found that the recovery result has some improvement compared to the clean speech.(i.e. v_enframe ->fft ->ifft -> v_overlapadd ,hamming,256 point,64 inc). And there is a line in the program :
(z(repmat(1:nf,nr,1)+repmat((0:nr-1)'*inc+rem((0:nr-1)',nb)*no,1,nf))=f.*repmat(w,nr,1);)
why we should f.*repmat(w,nr,1) ?
I look forward to your reply. Thank you.

@voicemike
Copy link
Collaborator

Hi,

(1) The expression f.*repmat(w,nr,1) multiplies each frame (i.e. each row of f) by the window w.
(2) The sequence v_enframe ->fft ->ifft -> v_overlapadd should have no effect on the samples except for the (n-inc) samples at both ends. However it is important to use the 'periodic' option of hamming() and also to normalize the window (see the code below). I hope this helps. Mike

inc=64;
nf=4inc;
s=randn(4
nf,1); % create a random signal
w=hamming(nf,'periodic'); % Hamming window with period nf
w=w/sqrt(sum(w(1:inc:nf).^2)); % normalize window
f=fft(v_enframe(s,w,inc),nf,2); % do STFT: one row per time frame
x=v_overlapadd(ifft(f,nf,2),w,inc); % reconstitute the time waveform
e=x-s; % calculate reconstruction error
max(abs(e(1+nf-inc:end-nf+inc))) % error is zero except at ends

@voicemike
Copy link
Collaborator

Autoformatting seems to have deleted the multiplications in lines 2 and 3 above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants