I'm developing a code to remove the noise in real time, so I need low latency between input and output. I'd like to work with 128 samples block size. The FFT size may be 4096 so I have to use the overlapped method. I have copied the overlapped algorithm from a book but I not sure about it. It seems that I can't overlap as I like, but at least it must be >= FFT/2, is it true? In the following implementation if I use overlap < FFT/2 the buffers (data[], over[]) override each other. Most of FFT sample use the Hanning (or similar) window before the FFT transform; using overlapped method I need to do it? I have tried to Hanning the data in my application but I got very strange behaviour. Without Hanning seems to work fine. Where is the true? void CDenoiseFFT::Denoise(fftw_real input[], fftw_real output[], long len) { long i; // load data for(i = 0; i < len; i++) { data[i] = input[i]; } for(i = len; i < FFT_SIZE; i++) { data[i] = 0; } // remove noise RemoveNoise(data, m_noise_max); // overlap data for(i = 0; i < FFT_SIZE-len; i++) { data[i] += over[i]; } for(i = len; i < FFT_SIZE; i++) { over[i-len] = data[i]; } // save data for(i = 0; i < len; i++) { output[i] = data[i]; } } I'm an absolutely beginner in FFT and overlapped, this is my first try, so any suggestion will be appreciate and sorry for my bad English!!
fft overlapped HELP!
Started by ●February 24, 2005
Reply by ●February 24, 20052005-02-24
> I'm an absolutely beginner in FFT and overlapped, this is my first > try, so any suggestion will be appreciate and sorry for my bad > English!!Hi Luca, see the book at www.dspguide.com. It is free and contains exactly what you need including good explanations. The code is also there (it is easy to transfer from Basic to another prog language). And this code works! Uli
Reply by ●February 25, 20052005-02-25
> Hi Luca, > see the book at www.dspguide.com. It is free and contains exactly what > you need including good explanations. The code is also there (it is > easy to transfer from Basic to another prog language). And this code > works! > UliHi Uli, my overlapped code is a porting from www.dspguide.com!!! If someone is interested I can post the complete source code. Luca
Reply by ●February 25, 20052005-02-25
What is the noise processing actually doing? Are you simply applying a filter (LP/HP/BP) to the input signal? If so, you could easily do this all in the time domain without having to worry about performing the FFT and switching to the frequency domain. In this case, all you would need is two circular buffes: One filled with your input samples, and the other filled with filter "kernal" samples. The filter kernal is just a representation of your filter in the time domain. The you can obtain your output sample. by convolving the values in the two buffers. The oldest input sample is then replaced with the newest incoming sample, and the process repeats. There should be an explanation of this process on www.dspguide.com. If, on the other hand, you need to perform the noise reduction in the frequency domain, I would do some more math to see what your limitations are to maintain a 'real time' system. If I understand correctly, you are first storing blocks of 128 samples of your input signal to an array. Next, you are performing an FFT on these samples. Third, you are performing the noise reduction on the resulting FFT. Next, you are performing an inverse FFT, and outputting the 128 samples that you just processed, then starting over. Does that sound right? If that is the case, then your actual system delay from input to output will be: 128 Samples * Seconds per Sample * (2 x FFT Processing Time in seconds) * (Noise Reduction Processing Time in seconds) The actual processing time for the FFT's and your noise reduction processing is probably nearly negligable compared to the time it takes to store 128 samples, depending on the processing speed. If you are able to, I would recommend trying the first method I described. In most cases you can save some time by not having to perform the FFT's, since everything is done in the time domain. I was working on a project and at first tried the overlap and add method also, but was getting some distortion in my output. When I switched to convolution in the time domain, my output was perfect. Good Luck. -CyRex
Reply by ●March 1, 20052005-03-01
"CyRex" <junkmail@settingrecords.net> wrote in message news:<1109362169.494754.7690@z14g2000cwz.googlegroups.com>...> What is the noise processing actually doing? Are you simply applying a > filter (LP/HP/BP) to the input signal? If so, you could easily do this > all in the time domain without having to worry about performing the FFT > and switching to the frequency domain. > ..... cut .....Hi, You are right! Working in time domain is faster, but I don't get the same quality. Using the algorithm from "Gnome Wave Cleaner" (gwc.sourceforge.net) I'm able to reduce al lest 20db of noise without any distortion or gate effect. I have ported the code in Cubase VST plug-in without CPU speed problem. The only problem is that the original code work off-line, so the latency is not important; but in my application I have to work in real-time. I have changed the code adding the overlapped method as described in www.dspguide.com (chapter 18). Everything is ok using big STEP, but if reduce the STEP less than FFT/2 the quality decrease. Taking a look at the source code is clear that is not possible to use this algorithm with STEP < FFT/2, the overlapped and the data buffers overwrite each other. Do you know if there are different algorithm or different implementation working on small STEP? I'd like to use STEP=128 and FFT=4096. Regards. Luca.
Reply by ●March 1, 20052005-03-01
Luca, How long is your source code? If you could list the filtering algorithm, I think that may help out a little bit. -Dan
Reply by ●March 1, 20052005-03-01
Luca Moreschi wrote:> "CyRex" <junkmail@settingrecords.net> wrote in message news:<1109362169.494754.7690@z14g2000cwz.googlegroups.com>... > >>What is the noise processing actually doing? Are you simply applying a >>filter (LP/HP/BP) to the input signal? If so, you could easily do this >>all in the time domain without having to worry about performing the FFT >>and switching to the frequency domain. >>..... cut ..... > > > Hi, > You are right! Working in time domain is faster, but I don't get the > same quality. > Using the algorithm from "Gnome Wave Cleaner" (gwc.sourceforge.net) > I'm able to reduce al lest 20db of noise without any distortion or > gate effect.... You could trade some of the speed-up for a longer filter and get much of the quality back. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●March 10, 20052005-03-10
I am also doing speech enchanment on BF531. my overlap method is: store the last 24 data of previous frame into the first 24 unit of current frame, then 80 new sampled data, pad 28 zeros at the end of frame. It sounds good after processing. But my suggestion is the frame size should be 512 unit at least, or you'll not get perfect result. mike -- ezpcb.comwww.totallychips.com - VHDL, Verilog & General Hardware Design discussion Forum
Reply by ●March 15, 20052005-03-15
ezpcb.com <ezpcb.com.1lo7dy@info@totallychips.com> wrote in message news:<1110445210.f2fcc9d30b63576a8be0fcb681b9e9db@teranews>...> I am also doing speech enchanment on BF531. my overlap method is: store > the last 24 data of previous frame into the first 24 unit of current > frame, then 80 new sampled data, pad 28 zeros at the end of frame. It > sounds good after processing. But my suggestion is the frame size > should be 512 unit at least, or you'll not get perfect result. > mike..mmm.. I don't understand: 24old+80new+28pad=132 is not valid for FFT!! May I use 192old+128new+192pad? When I rebuild the sound using the IFFT, which 128 sample I have to read? The first 128, the last 128 or the middle128 sample? Thanks, fft+overlap are driving me crazy!!