Help - Search - Members - Calendar
Full Version: FFT, Overlap, Blocks, ...
Hydrogenaudio Forums > Hydrogenaudio Forum > Scientific Discussion
MichaS
Hello,

I hope that you can help me.
I want to build up an FFT Metering.
My FFT is working. I think I know it because I get a clear signal when I do "audio.in -> FFT -> Meter -> iFFT -> audio.out". But to avoid Leakage I want to work with Hann and 50% overlap.

But I am a little bit confused about the overlap function with static Blocks.
I always have a static size of samples to calculate - let us say 4 (for simplicity) - from the whole audio file.


Am I right to do it like this.

- Get the first Samples "1234".
- Save the Samples "34" for the next calculation
- Do for the Samples "1234" : HannWindowing -> FFT -> Meter -> iFFT
- Save the first 2 calculated Audiosamples "ab"
- Return 0 (Silence)

- Get the next Samples "5678".
- Save "78" for the next caluclation
- Calculate "3456" with HannWindowing -> FFT -> Meter -> iFFT
- Save the first 2 calculated Audiosamples "cd".
- Calculate "5678" with HannWindowing -> FFT -> Meter -> iFFT
- Save the first 2 calculated Audiosamples "ef".
- Return "abcd"

- andsoon...


Thank you.
bryant
There are a lot of people here with more experience than me with this, but a couple things come to mind (I don't have any reference materials here; I assume you've looked online).

First, the result of the iFFT is going to have the windowing still there, so you can't just use it directly. You could apply the inverse of the windowing but you would get a lot of noise at the ends (where the gain approached infinity). Perhaps you could use only the middle half of the result and apply a partial inverse window.

Another idea would be to add the results back together and overlap them to the same degree that you started with. If you used a triangular window this would all go back together perfectly, but that's obviously not the ideal window. You could derive an inverse window function that could be applied to each entire result that would allow you to add them back together with original overlap. I think that's probably the ideal solution.

Hopefully someone who knows what they are talking about will respond soon... smile.gif
Woodinville
QUOTE(bryant @ Oct 24 2005, 12:51 PM)
There are a lot of people here with more experience than me with this, but a couple things come to mind (I don't have any reference materials here; I assume you've looked online).

First, the result of the iFFT is going to have the windowing still there, so you can't just use it directly. You could apply the inverse of the windowing but you would get a lot of noise at the ends (where the gain approached infinity). Perhaps you could use only the middle half of the result and apply a partial inverse window.

Another idea would be to add the results back together and overlap them to the same degree that you started with. If you used a triangular window this would all go back together perfectly, but that's obviously not the ideal window. You could derive an inverse window function that could be applied to each entire result that would allow you to add them back together with original overlap. I think that's probably the ideal solution.

Hopefully someone who knows what they are talking about will respond soon...  smile.gif
*



Well if you think briefly you realize that you need to use the window both before and after the FFT and IFFT, and that you need to use some overlap.

Then you realize quickly that the overlap of the window squared with itself at the shift length has to be == 1.

Then you can move onward. There are infinitely many windows that can do this. Using a twiddle-like structure to get the n/2 window coef's (hint, the other half are determined from the first half) assures you get the right values already.
SebastianG
Hello, MichaS !

I would like to know what you mean by "metering". What's the purpose of the iFFT in there ? Are you altering the transform coefficients ? If yes, what are you trying to achieve ? If not, why using the iFFT at all ?

I'm just trying to understand what you're after. It's not clear to me.


Sebi
MichaS
Good morning,

Thank you for getting back.

QUOTE(SebastianG @ Oct 24 2005, 06:36 PM)
I would like to know what you mean by "metering". What's the purpose of the iFFT in there ?


Metering : Perhaps it is a wrong word. After I did FFT I look to the Frequencies.

iFFT : I am doing this because I want to have my signal back and see if the calculation (FFT/iFFT) are correct.

To clarify more, I am doing this.
Get Audiosamples -> do HannWindowing -> put samples in FFT -> look at Frequencies -> do iFFT -> do HannWindowing-back to get Audiosamples back.


Thank you.
SebastianG
QUOTE(MichaS @ Oct 25 2005, 07:40 AM)
To clarify more, I am doing this.
Get Audiosamples -> do HannWindowing -> put samples in FFT -> look at Frequencies -> do iFFT -> do HannWindowing-back to get Audiosamples back.
*



If you just want to test your FFT/iFFT code then just put in some samples, apply the FFT and iFFT and post-scaling and see if the outcome is similar (Theoretically it should be the exact input but since we're usually working with limited accuracy there'll be some rounding errors). No need to apply any window functions and stuff.

Sebi
MichaS
QUOTE(SebastianG @ Oct 25 2005, 04:36 AM)
QUOTE(MichaS @ Oct 25 2005, 07:40 AM)
To clarify more, I am doing this.
Get Audiosamples -> do HannWindowing -> put samples in FFT -> look at Frequencies -> do iFFT -> do HannWindowing-back to get Audiosamples back.
*



If you just want to test your FFT/iFFT code then just put in some samples, apply the FFT and iFFT and post-scaling and see if the outcome is similar (Theoretically it should be the exact input but since we're usually working with limited accuracy there'll be some rounding errors). No need to apply any window functions and stuff.

Sebi
*



Hello Sebi,

Thanx.
Okay, I should have a look into.
'Cause when I try without a window -> I get a clear sound.
I am doing "Hamming" -> I get a clear sound.

I am doing "Hann", "Blackman" or "Bartlett" -> I get noise
(If I do the technique which I described I won't get noise. Hmmhmm, I really should get a pure sound for all window function on a static size of Blocks? I.e. I get 2048 Samples (do FFT/iFFT), then the next 2048 Samples (do FFT/iFFT), and so on...?)


Thanx.

SebastianG
You DO know that
some data -> FFT -> some action without alteration -> iFFT -> the same data
right ?

Just think about your signal processing chain and blend out everything bewteen FFT and iFFT (inclusive). Does it make sense ? I don't know (I still don't know what you're trying to achieve). Can you apply any window function if you want the output to be the same as the input ? Of course not ! Do you need the iFFT at all if you want the output to be the same as the inoput ? Of course not !

You COULD use the Vorbis window prior FFT and after the iFFT and do overlap/add. But you could also walk out of the door and scream loudly "I'm stacking FFT and iFFT for no reason". What you SHOULD do depends on your goal.

Sebi
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.