How to save 120 FFT values per second at 30 frames per second?


#1

My sketch will run at 30 frames per second. (much more will not be possible, its pretty much to render)
But i need very detailed audio data of the audio input.
If i save the values of the spectrum bands in every draw() iteration, i have 30 (or 30bands to be ecact) values every second. But this resolution is not high enough for my purposes. I would like to have at least 4 values per frame, which means not every 1/33 seconds but every 1/(334) seconds.

Same when i want to save just the amplitude in an array to plot the audio signal. Can i save only 30 values at 30 fps?

What would be a good solution for this?


#2

@Jan wouldn’t it be possible to get the audio data in a for-loop? let the for loop run 4 times every time draw runs once and do the visual part outside the for loop so that still runs at 30fps.
I’m just not entirely sure if the program would slow down because of this…


#3

Hi, here’s an example of doing non-real-time fft:

If you reduce the fftSize variable from 1024 to 256 I get 5.75 entries per frame at 30fps.
The produced file has a time stamp, (L, R) amplitudes, then 30 pairs of FFT values (L, R). That’s 63 numbers per row.