Setting Frequency Domain in libgdx FFT
-
26-09-2019 - |
Question
I'm new to Fourier Transforms, so can someone explain what I need to do to replicate this behaviour in fftw:
double* timeDomain = static_cast< double* >( fftw_malloc( sizeof( double ) * SEGMENTATION_LENGTH ) );
fftw_complex* frequencyDomain = static_cast< fftw_complex* >( fftw_malloc( sizeof( fftw_complex ) * ( ( SEGMENTATION_LENGTH / 2 ) + 1 ) ) );
fftw_plan forward = fftw_plan_dft_r2c_1d( SEGMENTATION_LENGTH, timeDomain, frequencyDomain, FFTW_MEASURE );
using libgdx's FFT class
I'm assuming that I'll want to initialize my FFT object thus:
//2048 is smallest power of 2 larger than SEGMENTATION_LENGTH
FFT fourier = new FFT(2048,44100);
but I can't find any methods relating to the frequency domain. I can do fourier.forward(samples)
, but it doesn't take any other parameters. Can someone give me a hint as to what I need to do here?
Solution
I think I've got the solution, there's a backward
method of FFT
that takes the frequency domain real and imaginary values that you can get after calling forward
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow