c - Using Accelerate framework to perform FFTs -
there few lines of code in this onset detection program make use of fftw3 library difficult incorporate ios. replace using accelerate framework.
in onsetdshelpers.h there member variable:
fftwf_plan fftplan;
and in onsetdshelpers.c there couple of malloc methods:
odsbuf->windoweddata = (float*) fftwf_malloc(framesizebytes); odsbuf->fftbuf = (float*) fftwf_malloc(framesizebytes); a method instantiate fftplan
odsbuf->fftplan = fftwf_plan_r2r_1d(ods->fftsize, odsbuf->windoweddata, odsbuf->fftbuf, fftw_r2hc, fftw_estimate); methods releasing memory:
void onsetsds_destroy_audiodata(onsetsdsaudiobuf *odsbuf){ // take down fftw stuff fftwf_destroy_plan(odsbuf->fftplan); // free mem free(odsbuf->data); free(odsbuf->window); fftwf_free(odsbuf->windoweddata); fftwf_free(odsbuf->fftbuf); } and method execute fft:
fftwf_execute(odsbuf->fftplan); my knowledge of c , ffts pretty limited. pointers me going in right direction appreciated.
Comments
Post a Comment