Old 12-08-2016, 04:43 AM   #1
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default FFT DC Bin

In the thread about Real FFT we discussed the handling of bin 0 (= "DC").

Here we found:

- with a normal complex FFT (imaginary part of the time-function = Zero), Bin 0 real part is the DC offset, Bin 0 imaginary part is Zero

- with a complex FFT used for handling a dual (stereo) time function (imaginary part of the time-function = second channel), Bin 0 real part is the DC offset of channel one, Bin 0 imaginary part is the DC offset of channel two.

- with a "real" FFT, Bin 0 real part is the DC offset, Bin 0 imaginary part is the power of the Nyquist frequency (half sample rate), either positive or negative regarding the phase of that partial.


In examples, I found three different ways of handling Bin 0 before doing an inverse FFT:

(a) don't apply any special handling at all

(b) set both real and imaginary value to Zero

(c) set both real and imaginary part to the appropriate average of all other bins.


There, we did not understand why (c) would make any sense.

After some more thinking I found:

It's not appropriate set the DC Bin to Zero. The cause being, that FFT is done in chunks and same don't necessary need to feature Zero DC offset by design. E.g. consider a sine wave as the signal to be converted. Now the window might start in the rising zero crossing and end in the falling zero crossing, hence including n+1/2 cycles. This results in a deterministic DC component. So setting the DC Bin to Zero would result in a deterministic aliasing.

Conclusion: the DC Bin needs to be preserved with an FFT based FIR Filter or similar component. (Supposedly with Real FFT the Nyquist value is rather unimportant and can be set to zero.)

Now the DC value should either be preserved or reconstructed. And Reconstructing it to be the average of all other bins in fact seems rather appropriate.

-Michael
mschnell is offline   Reply With Quote
Old 12-09-2016, 12:32 AM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

Setting DC to zero makes sense if you want to remove the DC offset. When using FFT & IFFT to process audio you will probably want to process the DC bin (and Nyquist bin) like any other bin, but probably not zero it.

To me setting it to the average of all other bins makes no sense.
Tale is offline   Reply With Quote
Old 12-09-2016, 06:01 AM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
Default

Sorry, but I need to contradict.

Please think about the example I gave above.

An FFT FIR filter works in chunks (usually) sized fftsize samples, and overlapping by fftsize / 2.

In fact this DC offset is the mean value of all samples contained in this chunk.

Lets assume (supposedly always given) that the FIR filter is not supposed to modify the general DC offset of the signal.

Now each chunk (before FFT) in fact does have a DC offset not equal Zero, as it is cut at arbitrary points of time in the signal (see example).

Setting the DC bin to Zero the DC offset of a chunk of samples (e.g. output by the FIR filter) to zero.

Setting the DC offset of each individual chunk to zero results in the resulting chunks not fitting perfectly at the boarders. This of course is tamed by the overlapping, but results in some aliazing, nonetheless.

Regarding reconstructing the DC Bin by calculating the mean of all other bins, I in fact did not try to find out if this in fact does make sense. With my project (crosstalk killer) I simply leave the DC bin as it is and suppose this gets me where I want.

-Michael
mschnell is offline   Reply With Quote
Old 12-09-2016, 06:48 AM   #4
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

Quote:
Originally Posted by mschnell View Post
In fact this DC offset is the mean value of all samples contained in this chunk.
Yeah, of all samples (time domain), but not of all bins (frequency domain).
Tale is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.