0
$\begingroup$

I am performing decorrelation of two channels of audio using all pass filtering. The two all pass filters for two channels are of very high order (>1000 but with not all coefficients non zero). I have to perform this filtering in frequency domain. I get input samples in 2048 frame size (48 K sampling) with 50 % overlap Hann windowed.

So to apply this filter (a small intermediate matlab snippet for one of the channels)

freq_resp_filter=freqz(filter_APF,4096,'whole');

fft_input_sig=fft(input_sig_frame,4096);

filtered_sig_fft=freq_resp_filter.*fft_input_sig;

filtered_sig_ifft=ifft(filtered_sig_fft); % done for testing only

final_2048_samples=filtered_sig_ifft(1:2048); % throw away last 2048 samples to                 
remove aliasing by fft convolution

and then i recombine this final_2048_samples with previous frames with overlapping.

When I listen to the output audio, I hear intermittent noise with signal, the noise is absent when I apply the same filter in time domain.

my question is: 1. Is this implementation correct (I have to perform this in frequency domain! and I can not do overlap add/save as this block is a part of a system, and I have no control over frame size, so every operation, 2048 samples should be given as output for further processing. )

Regards, Kd

$\endgroup$
  • $\begingroup$ Frequency-domain filtering the Hann-windowed data will not work perfect because it wraps around in time domain. Can't you revisit time domain by IFFT to manipulate the data for overlap add/save? You could still churn out 2048 samples for every input 2048 samples. $\endgroup$ – Olli Niemitalo Apr 14 '15 at 7:52
  • $\begingroup$ @OlliNiemitalo right now I am converting to time domain by ifft only for testing, but in reality the expected output of this block is in the frequency domain itself. Also, for this testing, If you see above, I am taking 4096 point fft of input data which is 2048 samples long(zero padding by 2048 to account for circular convolution of fft) and then after the ifft, throwing away last 2048 samples, and still I hear some distortion. (I will edit my answer to explain this throwing away part). Thanks $\endgroup$ – Kd_R Apr 14 '15 at 14:01
2
$\begingroup$

Here is a visual answer why it is not working. The overlap is not even symmetrical in the last step so the scheme can't work.

sheme 1

Even if you make it symmetrical by making the filter zero-delay, the amount of stuff that gets summed together varies by time, so it can't be right.

scheme 2

$\endgroup$
  • $\begingroup$ Sorry, I somehow can't log into my account, so I could not add comments to other answers. I am the OP. @olli , I understood your point. So is there any way to perform this entirely in frequency domain? $\endgroup$ – Kd_R Apr 14 '15 at 19:48
  • $\begingroup$ Please confirm/answer to the following: 1. The Hann window length is 2048 samples and the input has been windowed. 2. The input to your block is in frequency domain. 3. What is the length of this frequency domain input? 4. The above is not in your control. 5. What is the length of your frequency domain output? 6. When the system sums your outputs in an overlapping fashion, does it use all of your output or does it discard some? 7. Can your store the state across calls to your block? $\endgroup$ – Olli Niemitalo Apr 14 '15 at 21:13
  • $\begingroup$ @olli: answers to your questions: 1.Yes, window is 2048 samples long and the input has been windowed 2.Yes, the input to my block is in frequency domain 3.The length is 2048 samples 4.Yes, Its not in my control 5.The output of my block is in frequency domain of length 2048 6.In final stage, system takes IFFT of length 2048 , and it does NOT discard anything. 7. If by state, you mean previous 2048 frequency domain samples. then YES. $\endgroup$ – Kd_R Apr 15 '15 at 3:37
  • $\begingroup$ Thank you. I don't think it is possible to do the filtering in frequency domain without doing some manipulation in time domain by IFFT & FFT or using special tricks to interpolate the frequency domain data to 4096 bins so that you can do overlap-save/add separately on the streams of odd and the even input buffers (see hotpaw2's answer). FFT size doubling tricks are discussed in (Gardner 1995 Efficient Convolution Without Input–Output Delay) cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF $\endgroup$ – Olli Niemitalo Apr 15 '15 at 3:50
0
$\begingroup$

You can't just throw away the last 2048 time-domain samples of the circular convolution as they contain part of the convolution results (as least for the length of the impulse response of the filter - 1). For fast convolution filtering, you must save those samples for subsequent overlap save processing, or else the process will be lossy, perhaps severely so.

If you want to use overlapping Von Hann windows, the windows have to overlap by an exact integer sub-multiple of the window width in order for the amplitude envelope of the resulting window sum to be unmodulated (except for the very beginning and end of the overlap sequence). This works because the process ends up being a linear decomposition and re-composition with a linear operation in the middle (assuming correct overlap add/save fast convolution, and, again, except at the very beginning and very end).

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.