0

I am working on implementing an algorithm using vDSP.

1) take FFT 2) take log of square of absolute value (can be done with lookup table) 3) take another FFT 4) take absolute value

I'm not sure if it is up to me to throw the incoming data through a windowing function before I run the FFT on it.

vDSP_fft_zrip(setupReal, &A, stride, log2n, direction);

that is my FFT function

Do I need to throw the data through vDSP_hamm_window(...) first?

skaffman
  • 398,947
  • 96
  • 818
  • 769
P i
  • 29,020
  • 36
  • 159
  • 267
  • You might want to also mention what platform you're working with - it looks like it's probably Mac OS X or iOS. – Paul R Jan 03 '11 at 15:59

3 Answers3

3

It sounds like you're doing cepstral analysis and yes, you do need a window function prior to the first FFT. I would suggest a simple Hann or Hamming window.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • I've never done it, but I thought if you're analyzing a transient to characterize an echo, you don't window prior to the first FFT? – mtrw Jan 03 '11 at 09:55
  • @mtrw: I'm assuming, perhaps wrongly, that the OP is using cepstral analysis for speech, in which case you probably do want a window function, but this may not be the case for all applications. – Paul R Jan 03 '11 at 10:17
  • You're right - http://stackoverflow.com/questions/4583950/cepstral-analysis-for-pitch-detection. – mtrw Jan 03 '11 at 11:51
3

The iOS Accelerate library function vDSP_fft_zrip() does not include applying a window function (unless you count the implied rectangular window due to the finite length parameter).

So you need to apply your chosen window function (there are many different ones) first.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
2

I don't have any experience with your particular library, but in every other FFT library I know of it's up to you to window the data first. If nothing else, the library can't know what window you wish to use, and sometimes you don't want to use a window (if you're using the FFT for overlap-add filtering, or if you know the signal is exactly periodic in the transform block).

Also, just offhand, it seems like if you're doing 2 FFTs, the overhead of calling a logarithm function is relatively minor.

mtrw
  • 34,200
  • 7
  • 63
  • 71