DSPRelated.com
Forums

Logarithmically spaced bins

Started by December16 December 25, 2010
On Dec 30, 5:16&#4294967295;am, "December16" <december16@n_o_s_p_a_m.mail.ru>
wrote:
> Would you be so kind in giving me a reference how re-sampling the frequency > of an FFT into logarithmic bins is done. It would be of a great help. What > kind of FFT-based approach you mean?
You can interpolate FFT results using an interpolation kernel consisting of the transform of the window used before the FFT. In the case of a rectangular window, this would be the common Sinc interpolation method, similar to that use in resampling audio. If the resulting bin spacing is much wider than the transform of the window, you can get other interesting or useless results by fattening the interpolation kernel to simulate the application of an narrower time domain window, of the width which would have produced a filter closer to constant Q over frequency. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
On Dec 30, 5:16&#4294967295;am, "December16" <december16@n_o_s_p_a_m.mail.ru>
wrote:
> ...
> > Would you be so kind in giving me a reference how re-sampling the frequency > of an FFT into logarithmic bins is done. It would be of a great help. What > kind of FFT-based approach you mean? > Thanks in advance, > Kind regards, Sergiu
You already have two reasonable implementations of coherent fft implemented constant Q logarithmically spaced filters. If you don't need a coherent implementation for your audio fingerprinting, you can simply sum the power of closest fft bins into each log spaced center frequency and normalize each such incoherent filter by the number of bins summed into it. This would produce a set of incoherent fft implemented roughly constant Q logarithmically spaced filters and require less processing. Dale B. Dalrymple
> ... >You already have two reasonable implementations of coherent fft >implemented constant Q logarithmically spaced filters. If you don't >need a coherent implementation for your audio fingerprinting, you can >simply sum the power of closest fft bins into each log spaced center >frequency and normalize each such incoherent filter by the number of >bins summed into it. This would produce a set of incoherent fft >implemented roughly constant Q logarithmically spaced filters and >require less processing. > >Dale B. Dalrymple >
Hi Dale, As I've understood you, in order to have non-coherent implementation, it is enough to create a log-spaced array of frequencies (32 elements between [318 ; 2000], which yields to 32 items: 318.000000000000 337.433738089353 358.055118241995 379.936720095667 403.155558802797 427.793356095377 453.936827915262 481.677989622234 511.114479854074 542.349904178478 ... 2000.00000000000 After I have these frequency values, I can sum up frequencies between each two items from the log spaced array: spectrum = FFT(signal); for (int i = 0; i < logBins /*32 log spaced bins*/; i++) { int lowBound = _log[i]; /*start index*/ int hiBound = _log[i + 1]; /*end index*/ for (int k = lowBound; k < hiBound; k++) { sumFreq[i] += spectrum[k].SquaredMagnitude; } sumFreq[i] = sumFreq[i]/(hiBound - lowBound); /*Normalize*/ } This seems to be a reasonable implementation, also a fast one. The only question is whether to sum up SquaredMagnitude of FFT bin value or just the Magnitude. Thank you for your clarifying posts, Kind regards, Sergiu C.
>Hi Dale, >As I've understood you, in order to have non-coherent implementation, it
is
>enough to create a log-spaced array of frequencies (32 elements between >[318 ; 2000], which yields to 32 items: > >
318.000000000000 337.433738089353 358.055118241995 379.936720095667 403.155558802797 427.793356095377 453.936827915262 481.677989622234 511.114479854074 542.349904178478 .. 2000.00000000000
> >After I have these frequency values, I can sum up frequencies between
each
>two items from the log spaced array: > >spectrum = FFT(signal); >for (int i = 0; i < logBins /*32 log spaced bins*/; i++) >{ > int lowBound = _log[i]; /*start index*/ > int hiBound = _log[i + 1]; /*end index*/ > for (int k = lowBound; k < hiBound; k++) > { > sumFreq[i] += spectrum[k].SquaredMagnitude; > } > sumFreq[i] = sumFreq[i]/(hiBound - lowBound); /*Normalize*/
>} > >This seems to be a reasonable implementation, also a fast one. The only >question is whether to sum up SquaredMagnitude of FFT bin value or just
the
>Magnitude. > >Thank you for your clarifying posts, >Kind regards, Sergiu C. >
So does anybody know what's the preferred way of summing the FFT bins? Absolute value or Absolute value squared?