Forums

Continuity in frequency domain, post processing to avoid time-domain aliasing

Started by ale.saccoia March 1, 2013
Hi list,
After a while without dealing with FFTs (audio processing), I have some ideas that I would like to implement� but first of all I'd like to clarify some of the doubts that I have never really solved. I write some stuff to arrive to the point, please correct me if I am wrong.
Everytime I do some FFT analysis and resynthesis using constant overlap and add I end up with hearing artifacts as soon as I start doing some deep changes in the spectrum. For what I know, I have to accept it and the only way of limiting these artifacts is limiting the amount of processing in the frequency domain to avoid aliasing in time. This is the advice I have had several times, really blurry and without any quantity involved. How much can I process the spectrum to avoid time-domain aliasing?
For example: the ideal lowpass filter. I understand that the impulse response of such a filter is the sinc function, whose duration is infinite. Using the STFT, the convolution with that impulse will fold back and give aliasing. A Butterworth filter has a nicer slope, and no discontinuities. The impulse response of such a filter has a ?finite? length (even if it's not, a window function can be applied), so the result of the frequency domain multiplication is going to be the same as the convolution in time domain, as long as I zero-pad by at least the length of the impulse response of the filter, to avoid circular convolution and time domain aliasing.

So, time domain aliasing comes from two interrelated factors:
- a discontinuity in the frequency response (FD)
- a truncation of the impulse response (TD)

Is there a way / is it a common thing to limit the "depth" of spectral transformation so that the impulse response of the transform fits within the length of the window + chosen zero-padding? Also, I can see that the steepness of the transitions between bins will affect the time aliasing after the IFFT. Is there any theory about limiting this steepness, doing a sort of frequency domain post-processing, to remove unwanted discontinuities? I would picture it as a sort ot rope draped on the bins: each segment of the rope can stretch up to a certain distance to reach the next bin. if it stretches too much, then the spectrum is going to be too steep to avoid time-domain aliasing. An optimal solution, given the original spectrum and the spectrum (that creates aliasing) that is the ideal result of one's algorithm, could be found through linear programming. Just a thought. What do you think? 
Thanks
Alessandro
On 3/1/13 2:04 PM, ale.saccoia wrote:

...
> The impulse response of such a filter has a finite length > (even if it's not, a window function can be applied), so the > result of the frequency domain multiplication is going to be > the same as the convolution in time domain, as long as I > zero-pad by at least the length of the impulse response of the > filter, to avoid circular convolution and time domain aliasing.
well, you *are* doing circular convolution in any case when using the FFT to do it. if overlapping is avoided, then time-domain aliasing is avoided. the way to avoid that particular overlapping with circular convolution is to limit the impulse response length and the frame hop distance (which sets how many new samples to process in each frame). if N is the FFT size (usually a power of 2), L is the length of the FIR and less than N, then the frame hop distance is N-L+1. that's how many samples you can process per frame with fast convolution. ...
> > Is there a way / is it a common thing to limit the "depth" of > spectral transformation so that the impulse response of the > transform fits within the length of the window + chosen zero-padding?
limit the length of the FIR. whatever filter you can get with an FIR of a limited length. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson <rbj@audioimagination.com> wrote:
> On 3/1/13 2:04 PM, ale.saccoia wrote:
>> The impulse response of such a filter has a finite length >> (even if it's not, a window function can be applied), so the >> result of the frequency domain multiplication is going to be >> the same as the convolution in time domain, as long as I >> zero-pad by at least the length of the impulse response of the >> filter, to avoid circular convolution and time domain aliasing.
> well, you *are* doing circular convolution in any case when using the > FFT to do it. if overlapping is avoided, then time-domain aliasing is > avoided. the way to avoid that particular overlapping with circular > convolution is to limit the impulse response length and the frame hop > distance (which sets how many new samples to process in each frame).
Or use DCT, which doesn't have the periodic boundary conditions that the FFT has. -- glen
Alessandro

RBJ is correct that you need to limit the length of your effective FIR. But when he speaks of the FIR, he means that you first design some FIR filter (with length less than the size of the FFT) that gives a particular desired frequency response, and then take the fft of that FIR, and then use those coefficients to multiply your signal spectrum.  

Reading your original post, it sounds like you are trying to directly manipulate quantities in the frequency domain, almost like you had a  graphic equalizer with a lot of knobs. So you are looking for some simple rules to follow in the frequency domain to make sure you don't get aliasing.

I think your intuition about making only gentle changes is probably correct, but one way to enforce the correct rule would be to dial in your desired "spectral modification array", inverse transform it into the time domain, truncate the time-domain buffer to "obey the law", and then transform back. This should the give you a new array that you can use to multiply with the signal fft frames. If you have made gentle changes then the desired and modified responses shouldn't look too different. 

I think one reason the "gentle change" rule sort of works is that for any particular frequency, there will be energy across several bins (depending on your window function), and in order for alias cancellation to work those bins need to have certain amplitude/phase relationships relative to each other, and if you simply dial in some zero-phase frequency-domain modifications you are violating those required relationships. By only making gentle changes, the relative amplitudes between bins that all contribute to a particular frequency are pretty close to their correct alias-canceling condition.

I'm sure there are more elegant mathematical ways to construct a spectral modification array that will not cause aliasing, but my guess is that they will be more complicated than the steps of inverse transform, truncate, and re- transform that I mentioned above.



Note that I am not 100% confident about my answer, so someone please correct me if I got it wrong. 


Bob
>Is there a way
Key words: oversampled filter banks. Look for example simulink model http://electronix.ru/forum/index.php?s=&showtopic=23652&view=findpost&p=929325