DSPRelated.com
Forums

window and fft

Started by cfx August 19, 2003
Hi, I have a little problem ...
I am working with audio datas,
I get the datas block by block.
I have to process the datas in the fourier domain,
for that I windowing a signal block and then I compute
the fft, process the block in the fourier domain, compute
the ifft and overlap with a previous processed block.
The problem is that the processing in the fourier domain
modify the signal phase for each frequency component.
That implie a sliding of the window
and then when I overlap the blocks, the sum is not 1.
So, the question is :
    does anyone have a solution to this problem ?

--cf.

ps: please excuse my english, I'm french.


Hi!

The sum is not one, the phase get shifted and you
hear woble... There is no real solution, just
different patching aproaches.. Try to fit the phase
Use a cosine (hanning window). Overlapp by  50%...

-- 
Regards!
Atmapuri

www.dewresearch.com
"cfx" <u.t.o@wanadoo.fr> wrote in message
news:bhstp4$pje$1@news-sop.inria.fr...
> Hi, I have a little problem ... > I am working with audio datas, > I get the datas block by block. > I have to process the datas in the fourier domain, > for that I windowing a signal block and then I compute > the fft, process the block in the fourier domain, compute > the ifft and overlap with a previous processed block. > The problem is that the processing in the fourier domain > modify the signal phase for each frequency component. > That implie a sliding of the window > and then when I overlap the blocks, the sum is not 1. > So, the question is : > does anyone have a solution to this problem ? > > --cf. > > ps: please excuse my english, I'm french. > >
"cfx" <u.t.o@wanadoo.fr> wrote in message news:<bhstp4$pje$1@news-sop.inria.fr>...
> Hi, I have a little problem ... > I am working with audio datas, > I get the datas block by block. > I have to process the datas in the fourier domain, > for that I windowing a signal block and then I compute > the fft, process the block in the fourier domain, compute > the ifft and overlap with a previous processed block. > The problem is that the processing in the fourier domain > modify the signal phase for each frequency component. > That implie a sliding of the window > and then when I overlap the blocks, the sum is not 1. > So, the question is : > does anyone have a solution to this problem ?
It's hard to suggest a solution without a better description of the data, what processing you do, how you do the processing, and what result you expect. Having said that, windowing could do some "damage" to norm of the data vector. If you have a data vector that is normalized to unit norm and use a non-rectangular window, the windowed vector need not be of unit norm. Rune
First, thanks for your attention.

The goal of the processus is to apply a little decorrelation to a source
audio signal in real time.
And this by applying a little phasing on each signal frequency component.

We can considere that I have a some audio data and I can get these data only
by blocks of 1024 samples.
When I get a block, I apply an Hanning window to the block and compute the
fft (fftsize == 1024).
In the fourier domain I want to modifie the phase of each frequency
component.
For that I dispose of a transfert function (an array of 512 complexes) that
for doing that, each complex, of the
transfert function, associated to a frequency component had a unit modul and
an argument  between
0 and pi/3. Then I multiply the fft of my block with the transfert function
and compute the ifft.

If the block received is the block [n,n+1024-1] ('n' is a arbitrary absolute
sample indices), I dispose of a previous windowed block [n-1024,n-1], I
overlap these two blocks such that the data [n-512,n+512-1] are valid
processed
data if there is no modification of the signal phase in the processing, but
this is not the case.
My interpretetion of this phenomena is a sliding of the window due to the
frequency phasing apply by the processus.

But now, I am not an expert in Signal Processing, and it is possible that I
made a great mistake in my raisonment, and maybe it is not possible to do
what I want by this way.

Thanks,
-cf.


"cfx" <u.t.o@wanadoo.fr> wrote in message news:<bhtaol$53a$1@news-sop.inria.fr>...
> First, thanks for your attention. > > The goal of the processus is to apply a little decorrelation to a source > audio signal in real time. > And this by applying a little phasing on each signal frequency component. > > We can considere that I have a some audio data and I can get these data only > by blocks of 1024 samples. > When I get a block, I apply an Hanning window to the block and compute the > fft (fftsize == 1024). > In the fourier domain I want to modifie the phase of each frequency > component. > For that I dispose of a transfert function (an array of 512 complexes) that > for doing that, each complex, of the > transfert function, associated to a frequency component had a unit modul and > an argument between > 0 and pi/3. Then I multiply the fft of my block with the transfert function > and compute the ifft.
OK. You are applying an all-pass filter to your signal in frequency domain. Now, I can't see the relation between the 512 complex samples of the transfer function and the block size of 1024. Is the transfer function specified in frequency domain? If so, what do you do with the frequency bins between the Nyquist frequency and the sampling frequency?
> If the block received is the block [n,n+1024-1] ('n' is a arbitrary absolute > sample indices), I dispose of a previous windowed block [n-1024,n-1], I > overlap these two blocks such that the data [n-512,n+512-1] are valid > processed > data if there is no modification of the signal phase in the processing, but > this is not the case. > My interpretetion of this phenomena is a sliding of the window due to the > frequency phasing apply by the processus.
Your problem appears to be how to patch blocks in time domain, considering that each sample is represented in two blocks...
> But now, I am not an expert in Signal Processing, and it is possible that I > made a great mistake in my raisonment, and maybe it is not possible to do > what I want by this way.
I think it should be possible to implement a filter this way. You would probably need to pay some attention to quite a few details, though. Having said that, my immediate response (provided I understand your problem correctly) is that you may want to consider a time-domain implementation of your all-pass filter. I don't know much about such implementations, but there may be others here who can help you with the details. If that's not an option, you may try to compute the time series as some sort of weighted average between blocks. Assume you want to reconstruct the samples [n,n+512-1]. The deconvolved data would come from the trailing half of the block [n-512,n+512-1] (call these samples a(m), m=0,...,511) and the leading half of the block [n, n+1024-1] (call these samples b(m), m=0,...,511). The resulting segment of the time series x(n) could then be computed with the naive constant weighting x(n+m) = 1/2(a(m)+b(m)) m=0,...,511 or possibly a more elaborate ramp weighting x(n+m) = (511-m)/511*a(m)+ m/511*b(m) m=0,...,511. In any case, there will be differences between the patched data from such a block-wise approach, and data comupted either in time domain or with other block sizes. Rune
allnor@tele.ntnu.no (Rune Allnor) wrote in message news:<f56893ae.0308190512.56cff59a@posting.google.com>...
> "cfx" <u.t.o@wanadoo.fr> wrote in message news:<bhstp4$pje$1@news-sop.inria.fr>... > > Hi, I have a little problem ... > > I am working with audio datas, > > I get the datas block by block. > > I have to process the datas in the fourier domain, > > for that I windowing a signal block and then I compute > > the fft, process the block in the fourier domain, compute > > the ifft and overlap with a previous processed block. > > The problem is that the processing in the fourier domain > > modify the signal phase for each frequency component. > > That implie a sliding of the window > > and then when I overlap the blocks, the sum is not 1. > > So, the question is : > > does anyone have a solution to this problem ? > > It's hard to suggest a solution without a better description of the > data, what processing you do, how you do the processing, and what result > you expect. > > Having said that, windowing could do some "damage" to norm of the > data vector. If you have a data vector that is normalized to unit > norm and use a non-rectangular window, the windowed vector need not > be of unit norm. > > Rune
If I understand correctly, the original poster is trying to implement processing of a time-domain signal in the frequency-domain using the well-known overlap-add method. If that is so then he should not apply a window to the blocks of time-domain samples (other than the rectangular window implicit in taking a block of samples.) Donald
"Donald Reay" <dsr@cee.hw.ac.uk> a &#4294967295;crit dans le message de news:
8bc732eb.0308191143.75b20bdd@posting.google.com...

> If I understand correctly, the original poster is trying to implement > processing of a time-domain signal in the frequency-domain using the > well-known overlap-add method. If that is so then he should not apply > a window to the blocks of time-domain samples (other than the > rectangular window implicit in taking a block of samples.)
If I do not apply the window to the signal, the FFT will damage the signal on the side of the block, or maybe there a method for diminishing these effects. I will try to use the overlap-add method by applying the window after the ifft, and see the results... Thanks, Charles-Felix.
> > Donald
"Rune Allnor" <allnor@tele.ntnu.no> a &#4294967295;crit dans le message de news:
f56893ae.0308191106.2b3944fd@posting.google.com...
 > OK. You are applying an all-pass filter to your signal in frequency
domain.
> Now, I can't see the relation between the 512 complex samples of the > transfer function and the block size of 1024. Is the transfer function > specified in frequency domain? If so, what do you do with the frequency
bins
> between the Nyquist frequency and the sampling frequency?
The sampling rate is equal to 44100, the FFTSIZE to 1024, and my fft function return FFTSIZE/2 complex samples, with each corresponding to a frequency component from SAMPLINGRATE/FFTSIZE to SAMPLINGRATE/2.
> > Your problem appears to be how to patch blocks in time domain, considering > that each sample is represented in two blocks... >
> > I think it should be possible to implement a filter this way. You would > probably need to pay some attention to quite a few details, though. > > Having said that, my immediate response (provided I understand your
problem
> correctly) is that you may want to consider a time-domain implementation > of your all-pass filter. I don't know much about such implementations, but > there may be others here who can help you with the details.
I was looking for a such temporal method, but I haven't found a representation of an all-pass such that this one ( e^(j*2*pi*g(Fn)) with Fn = n*SAMPLINGRATE / FFTSIZE, and g a fnction of Fn) in the time domain (so if any one have one ;)). I will try to apply the Allpass filter in the frequency domain without pre-applying a window on the time domain samples, and apply the window after the ifft and overlap-add the blocks.
> Rune
Thanks, Charles-Felix
"cfx" <u.t.o@wanadoo.fr> wrote in message news:<bhvd6b$ins$1@news-sop.inria.fr>...
> "Donald Reay" <dsr@cee.hw.ac.uk> a &#4294967295;crit dans le message de news: > 8bc732eb.0308191143.75b20bdd@posting.google.com... > > > If I understand correctly, the original poster is trying to implement > > processing of a time-domain signal in the frequency-domain using the > > well-known overlap-add method. If that is so then he should not apply > > a window to the blocks of time-domain samples (other than the > > rectangular window implicit in taking a block of samples.) > > If I do not apply the window to the signal, the FFT will > damage the signal on the side of the block, or maybe there > a method for diminishing these effects. > I will try to use the overlap-add method by applying the window > after the ifft, and see the results... > Thanks, > Charles-Felix. > > > > > Donald
Again assuming that I understand correctly what you are trying to do, I'd comment that the overlap-add method of fast convolution doesn't involve windows. I would argue that the FFT doesn't damage a signal. The FFT is a transformation of a sequence of time domain samples into an alternative, and in terms of information equivalent, sequence of frequency domain samples. What I understand you to be doing is Take a block of L time-domain samples, zero-pad to 2L samples, take their 2L point FFT, process them in the frequency domain by point by point multiplication (2L multiplications), take the IFFT of this result and overlap-add L of the 2L sample result with L samples of the previous result to obtain a block of L time-domain output samples. Repeat (saving the un-overlapped L sample part of the most recently calculated IFFT result.) No windowing involved. For this to 'work', there are limitations on the nature of the point by point multiplication you carry out. For example, you can't implement a brick wall low pass filter by multiplying 'low frequency' frequency domain samples by 1 and 'high frequency' frequency domain samples by 0. The set of frequency domain multiplication coefficients you use must correspond to a time-limited (to L samples) impulse response. This may be the aspect that you should be investigating. Coming up with the multiplication coefficients that you use may involve windowing of an ideal time-domain impulse response. In these terms, it may be that you're going to have to accept less than ideal all-pass filter performance if L is finite. HTH Donald
cfx wrote:
> > "Donald Reay" <dsr@cee.hw.ac.uk> a &#4294967295;crit dans le message de news: > 8bc732eb.0308191143.75b20bdd@posting.google.com... > > > If I understand correctly, the original poster is trying to implement > > processing of a time-domain signal in the frequency-domain using the > > well-known overlap-add method. If that is so then he should not apply > > a window to the blocks of time-domain samples (other than the > > rectangular window implicit in taking a block of samples.) > > If I do not apply the window to the signal, the FFT will > damage the signal on the side of the block, or maybe there > a method for diminishing these effects. > I will try to use the overlap-add method by applying the window > after the ifft, and see the results... > Thanks, > Charles-Felix. > > > > > Donald
What you call damage is artifacts caused by discontinuities at the edges of the blocks. I think that what you want to do amounts to fast convolution, and the prescribed overlap eliminates all edge effects but the first and last. You could treat those with half windows, but with little discernible benefit. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;