There are a few lines of code in this onset detection program that make use of the FFTW3 library which is difficult to incorporate into iOS. I would like to replace it using the Accelerate framework.
In onsetdshelpers.h there is a member variable:
fftwf_plan fftplan;
and then in onsetdshelpers.c there are a couple of malloc methods:
odsbuf->windoweddata = (float*) fftwf_malloc(framesizebytes);
odsbuf->fftbuf = (float*) fftwf_malloc(framesizebytes);
a method to instantiate fftplan
odsbuf->fftplan = fftwf_plan_r2r_1d(ods->fftsize, odsbuf->windoweddata, odsbuf->fftbuf, FFTW_R2HC, FFTW_ESTIMATE);
methods for releasing memory:
void onsetsds_destroy_audiodata(OnsetsDSAudioBuf *odsbuf){
// take down the FFTW stuff
fftwf_destroy_plan(odsbuf->fftplan);
// free mem
free(odsbuf->data);
free(odsbuf->window);
fftwf_free(odsbuf->windoweddata);
fftwf_free(odsbuf->fftbuf);
}
and finally the method to actually execute the FFT:
fftwf_execute(odsbuf->fftplan);
My knowledge of C and FFTs is pretty limited. Any pointers to get me going in the right direction which be much appreciated.