h4yn0nnym0u5e
Well-known member
Hi folks
I've been tinkering with the FFT code in the audio library, and think I've made some improvements:
The relevant branch can be found here. As ever, if you try it and find issues, please post a simple sketch which demonstrates the problem, that can be compiled using the Arduino IDE, and that requires no extra hardware.
I've been tinkering with the FFT code in the audio library, and think I've made some improvements:
- processing is now spread across
update()
calls, so the peak CPU load has dropped (slightly) - works with smaller values of
AUDIO_BLOCK_SAMPLES
, and some larger ones (up to the FFT size)- I could probably make it work with even larger block sizes, but mostly people want smaller to reduce latency
- there was untested and broken code for 64-sample blocks, apparently for Teensy LC, dating from 2015: I removed this
AudioAnalyzeFFT1024
can now do averaging, asAudioAnalyzeFFT256
already could- there's now only one pair of files,
analyze_fft.cpp
and.h
, as pretty much all the code is common to both classes
AudioAnalyzeFFT1024
objects now consume an extra 2kB of RAM for the averaging. If that's a problem it'd be very easy to revert it, and add a new object called something like AudioAnalyzeFFT1024Averaging
.The relevant branch can be found here. As ever, if you try it and find issues, please post a simple sketch which demonstrates the problem, that can be compiled using the Arduino IDE, and that requires no extra hardware.