The important thing is to do anything that might take an unbounded amount
of time outside your callback. For a simple FFT, the rule of thumb might be
that all setup takes place outside the callback. For example, as long as
you do all your malloc stuff outside the callback, processing and so on can
usually be done in the callback.

For some sample code (not using FFTW, but it's similar):

http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html


On Thu, Jun 11, 2015 at 10:20 AM, Connor Gettel <connorget...@me.com> wrote:

> Hello Everyone,
>
> My name’s Connor and I’m new to this mailing list. I was hoping somebody
> might be able to help me out with some FFT code.
>
> I want to do a spectral analysis of the mic input of my sound card. So far
> in my program i’ve got my main function initialising portaudio,
> inputParameters, outputParameters etc, and a callback function above
> passing audio through. It all runs smoothly.
>
> What I don’t understand at all is how to structure the FFT code in and
> around the callback as i’m fairly new to C. I understand all the steps of
> the FFT mostly in terms of memory allocation, setting up a plan, and
> executing the plan, but I’m still really unclear as how to structure these
> pieces of code into the program. What exactly can and can’t go inside the
> callback? I know it’s a tricky place because of timing etc…
>
> Could anybody please explain to me how i could achieve a real to complex 1
> dimensional DFT on my audio input using a callback?
>
> I cannot even begin to explain how grateful I would be if somebody could
> walk me through this process.
>
> I have attached my callback function code so far with the FFT code
> unincorporated at the very bottom below the main function (should anyone
> wish to have a look)
>
> I hope this is all clear enough, if more information is required please
> let me know.
>
> Thanks very much in advance!
>
> All the best,
>
> Connor.
>
>
>
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
>



-- 
Bjorn Roche
@shimmeoapp
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to