I have two filters which must apply (in series) to same input data $x[n]$ e.g of length 256 (real time asio input buffers). One filter is e.g. an impulse response $h_1[n]$ of a speaker and other one an IR $h_2[n]$ of a lowpass (created by sinc, blackman). For simplicity lets say both are shorter than 256.

So I zero pad the input and both IRs to 512, FFT and then do: $X[k]\cdot H_1[k]\cdot H_2[k]$, after this I do iFFT and use overlap-add to deal with the output vector of length 512. I do use a wrapped version of FFTW for performance reasons. FFTW tutorial says that doing FFT and afterwards iFFT of a vector of length $N$ produces an output vector which must be scaled by $\frac{1}{N}$.

My understanding problem here is, how do I have to scale? In the upper example I don't just do FFT$\to$iFFT, but I am doing FEW forward FFT of different filters, multiply them and do only one backward iFFT.

  • $\begingroup$ the iFFT in FFTW does not do the conventional scaling of $\frac1N$ that is in the most common convention of the definition of the inverse (or "backward") Discrete Fourier Transform. I try, in this answer, to be explicit about the consequences (regarding convolution) of convention of where the $\frac1N$ scaling factor goes. $\endgroup$ Aug 6 '19 at 7:49
  • $\begingroup$ I am not sure if I get it right. If I use FFTW for e.g. 1 input x[n] and three filters h1[n], h2[n] and h3[n] all zero padded to N, then do FFT on each and multiply those three Y[k]=X[k]*H1[k]*H2[k]*H3[k]. After this I transform back using y[n]=iFFT[(Z[k]). How should i skale y[n]? $\endgroup$
    – f.f
    Aug 6 '19 at 8:16
  • $\begingroup$ by $\frac1N$ where $N$ is the length of the FFT and iFFT in FFTW. also, keep in mind that the linear convolution of a sequence having non-zero length $M$ with another having non-zero length of $L$ results in a sequence of length $M+L-1$. so when convolving four sequences together, add the non-zero lengths of them all. the FFT length $N$ must be as large as that sum of lengths. zero pad to that length $N$. $\endgroup$ Aug 6 '19 at 9:04
  • $\begingroup$ so before I added the 2nd filter I had: signal x(N1=256), filter h1(N2=256) and zero padded each to N=512 before fft. all worked fine, Now I have an additional filter (which I multiply in freq domain) of h2[L] with L (0<L<256). I zero padded this one also to 512 and went on. This was wrong right? since I have N1+N2+L which is >512 I need to zero pad now all inputs x,h1 and h2 minimum to length N1+N2+L right?? Could this explain my strange sizzle after adding the filter h2. Aliasing? $\endgroup$
    – f.f
    Aug 6 '19 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.