-1

I'm attempting to implement kiss FFT real calculations.

As I'm sure everyone is aware I'm not the first person asking about kiss FFT here, nor about kiss_fftr specifically. I am fairly new to FFT, but have gotten most of the basics down, and am now trying to implement it in an audio frequency analyzer in an ATxmega192A3.

Here is the basic code I've copied and modified in an attempt to input 512 8 bit ADC samples into an FFT in order to get 256 output frequency bins.

int size = 512;
int isinverse = 1;
kiss_fft_scalar zero;
memset(&zero,0,sizeof(zero));
kiss_fft_cpx fft_in[size];
kiss_fft_cpx fft_out[size];

kiss_fftr_cfg fft = kiss_fftr_alloc(size*2,0,0,0);

//load 512 samples from ADC into fft_in[].r and zero out fft_in[].i, fft_out[].i, and fft_out[].r

kiss_fftr(fft, (kiss_fft_scalar*) fft_in, fft_out);

Here are my questions:

  1. Is there any overlap in the out bins? Meaning if I'm viewing.. say the 12Hz out bin is it showing ONLY 12Hz and not rounding in 12.1Hz partially (I am aware audio is not quite that precise so there will be residual physical effects causing interference)?

  2. I am having a hard time figuring out how to use the kiss_fftr_cfg. I am unsure of where all of the options are labeled as far as using it with 8 bit ints (or 16 bit, but doesn't that mean all my input samples need to be 16 bit? Everything in the previous code before and including the cfg's declaration I don't understand outside of the first two int declarations he made, and am not sure why he used memset instead of allowing kiss_fftr to allocate space. Where might I find more information?? I've looked through most of the included files with kiss_fft, and don't seem to find much helpful info digging through the code at the expense of hours and hours.

Anthon
  • 69,918
  • 32
  • 186
  • 246

1 Answers1

1

The FFT output bins have a bandwidth of roughly 2*Fs/N (sample rate over FFT length), but fall-off or transition as a Sinc shaped function. Thus all FFT result bins overlap with all other bins except at bin centers.

Using kiss FFT requires knowing about C data types and which automatic conversions work or not.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • Hmm, so the answer to question "1)" is "Yes, there is overlap." Thanks! I know about C's ability to automatically convert variable types which I assume you are referring to. Dealing with floating points takes longer than say.. unsigned integers which often makes a big difference on MCU CPU cycles. I was hoping to use integers in place of the default floating point if possible, but cannot find detailed documentation anywhere on configuration options! – Daniel Vandermeir May 04 '15 at 17:01