FastLED 3.9.15
|
Files | |
_kiss_fft_guts.h | |
cq_kernel.c | |
cq_kernel.h | |
kiss_fft.c | |
kiss_fft.h | |
kiss_fftr.c | |
kiss_fftr.h | |
A fast C library that generates and applies spectral kernels on the output of an FFT, resulting in a constant Q transform overall and as specified in "An efficient algorithm for the calculation of a constant Q transform" by Brown (google it for reference). It is dependent on kissfft, so the v131 release is bundled here, but it can also be applied on the output of any FFT program.
While initalizing, this library is relatively slow and memory-heavy: it needs to execute an FFT for one band at a time, requiring two buffers for its real input and complex output. However, the library uses a little less (and not much more) at runtime by storing all the kernels as sparse arrays (throwing out the smallest values). Sparse arrays also make the library very fast at runtime, so embedded use is possible.
An example has been provided. Using #define
'd parameters, it generates and dumps its kernels in a format that can be pasted into Excel or MATLAB. To get the floating-point version, in the command line run:
To get the Q15 version, in the command line run:
There is a Q31 version that is currently broken. To try that, in the command line run:
Here is what that Excel plot of the kernels ("K_mag.txt") looks like. It is very similar to Figure 2 in the CQT paper:
Be warned, making the maximum frequency too close to half the sampling frequency causes the kernels to degenerate. Not having enough samples also causes the kernels to degenerate, so please edit, compile, then run the example to make sure your desired parameters are valid!
Now, to use this library in a project, retrieve the files
and write something like this (if you're using the included kissfft library)
and compile it with the appropriate flag based on the desired format, as required by kissfft. There is no flag for floating point. For Q15, that is -D FIXED_POINT=16
. For Q31, that is -D FIXED_POINT=32
.