开发者

Setting Frequency Domain in libgdx FFT

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜