pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
|
A simple, cross-platform FFT processor for audio signals. More...
Typedefs | |
typedef struct PlankFFTF * | PlankFFTFRef |
An opaque reference to the Plank FFTF object. | |
Functions | |
PlankFFTFRef | pl_FFTF_CreateAndInit () |
Create and initialise a Plank FFTF object and return an oqaque reference to it. | |
PlankFFTFRef | pl_FFTF_Create () |
Create a Plank FFTF object and return an oqaque reference to it. | |
PlankResult | pl_FFTF_Init (PlankFFTFRef p) |
Initialise a Plank FFTF object with a default length (PLANKFFTF_DEFAULTLENGTH). | |
PlankResult | pl_FFTF_InitWithLength (PlankFFTFRef p, const PlankL length) |
Initialise a Plank FFTF object. | |
PlankResult | pl_FFTF_DeInit (PlankFFTFRef p) |
Deinitialise a Plank FFTF object. | |
PlankResult | pl_FFTF_Destroy (PlankFFTFRef p) |
Destroy a Plank FFTF object. | |
void | pl_FFTF_Forward (PlankFFTFRef p, float *output, const float *input) |
Apply the FFT to the input and place the result in output. | |
void | pl_FFTF_Inverse (PlankFFTFRef p, float *output, const float *input) |
Apply the inverse-FFT to the input and place the result in output. | |
PlankL | pl_FFTF_Length (PlankFFTFRef p) |
Get the FFT size. | |
PlankL | pl_FFTF_HalfLength (PlankFFTFRef p) |
Get half FFT size. | |
float * | pl_FFTF_Temp (PlankFFTFRef p) |
Get a pointer to the internal temporary buffer. |
A simple, cross-platform FFT processor for audio signals.
This must be allocated/deallocated using pl_FFTF_Create() and pl_FFTF_Destroy(), a statically alloacted version is not currently available.
This makes use of other underlying libraries on request. By default it uses FFTReal (via the Plank FFTRealInternal class). To use vDSP on Mac OS X or iOS define the preprocessor macro PLANK_FFT_VDSP.
PlankFFTFRef fft; float input[128]; float output[128]; int i; fft = pl_FFTF_Create (128); // create with FFT size 128 // fill the buffer for (i = 0; i < 128; i++) { input[i] = i / 127.f; } pl_FFTF_Forward (fft, output, input); // perform the forward FFT, the result will be in output pl_FFTF_Destroy (fft); // destroy the FFT object
The layout of the resulting FFT bins is in a "packed" format which omits the imaginary components of the DC and Nyquist bins (as these are always zero anyway). This means that the size of the data input and output fits in the same memory size.
For the FFT size of 128 illustrated by the code snippet:
typedef struct PlankFFTF* PlankFFTFRef |
An opaque reference to the Plank FFTF object.
PlankFFTFRef pl_FFTF_Create | ( | ) |
Create a Plank FFTF object and return an oqaque reference to it.
PlankFFTFRef pl_FFTF_CreateAndInit | ( | ) |
Create and initialise a Plank FFTF object and return an oqaque reference to it.
PlankResult pl_FFTF_DeInit | ( | PlankFFTFRef | p | ) |
Deinitialise a Plank FFTF object.
p | The Plank FFTF object. |
PlankResult pl_FFTF_Destroy | ( | PlankFFTFRef | p | ) |
Destroy a Plank FFTF object.
p | The Plank FFTF object. |
void pl_FFTF_Forward | ( | PlankFFTFRef | p, |
float * | output, | ||
const float * | input | ||
) |
Apply the FFT to the input and place the result in output.
This may be performed in-place (i.e., input and output can point to the same data).
p | The Plank FFTF object. |
output | A pointer to an array of floats to store the result. |
input | A pointer to an array of floats holding the input data. |
PlankL pl_FFTF_HalfLength | ( | PlankFFTFRef | p | ) |
Get half FFT size.
This is just as a convenience as it is already cached for efficiency.
p | The Plank FFTF object. |
PlankResult pl_FFTF_Init | ( | PlankFFTFRef | p | ) |
Initialise a Plank FFTF object with a default length (PLANKFFTF_DEFAULTLENGTH).
p | The Plank FFTF object. |
PlankResult pl_FFTF_InitWithLength | ( | PlankFFTFRef | p, |
const PlankL | length | ||
) |
Initialise a Plank FFTF object.
p | The Plank FFTF object. |
length | The FFT size - this must be a power of 2 or less than 16 (where it will specify the log2 FFT size e.g., length 8 = pow(2,8) = 256 |
void pl_FFTF_Inverse | ( | PlankFFTFRef | p, |
float * | output, | ||
const float * | input | ||
) |
Apply the inverse-FFT to the input and place the result in output.
This may be performed in-place (i.e., input and output can point to the same data).
p | The Plank FFTF object. |
output | A pointer to an array of floats to store the result. |
input | A pointer to an array of floats holding the input data. |
PlankL pl_FFTF_Length | ( | PlankFFTFRef | p | ) |
Get the FFT size.
p | The Plank FFTF object. |
float* pl_FFTF_Temp | ( | PlankFFTFRef | p | ) |
Get a pointer to the internal temporary buffer.
This is an array of floats the size of the FFT. This could be useful as a scratch space to save allocating more memory. Of course its contents may be invalidated by any other Plank FFTF calls.
p | The Plank FFTF object. |