I'd like to build a "low fidelity" spectrum analyzer to run on an Adafruit Trinket Pro. My primary goal is to intrigue my seven year-old niece with something that can be hacked. The plan is to pick up sound from a violin with a mic and use a set of 5 or 6 NeoPixels to represent octaves and use color for amplitude.
My first pass at this used Amanda Ghassaei's frequency detection code. It kind of worked, but seemed to be having problems with complex waveforms. After doing some more reading and looking at simple spectrum analyzers it seems that I'd do better using something like a FFT to collect the frequency information. It also seems that that might be stretching the capability of an Arduino...
Are there any FFT libraries that run well on the Arduino (over a range of about 200 to 4000 Hz)? Or are there other approaches that might work better?
-
A Trinket might be too slow; there are a number of FFT libraries for things like the Teensy which runs at 72MHz+, as in this Adafruit articleCharlieHanson– CharlieHanson2015年12月24日 00:52:01 +00:00Commented Dec 24, 2015 at 0:52
-
2I tell a lie, there do appear to be ones that run on slower processors. This article, also from Adafruit, describes one that samples at around 9.6kHz, which should be enough for up to 4.8kHz analysis.CharlieHanson– CharlieHanson2015年12月24日 00:55:48 +00:00Commented Dec 24, 2015 at 0:55
-
DFT is an alternative to FFT.Gerben– Gerben2015年12月24日 15:54:50 +00:00Commented Dec 24, 2015 at 15:54
-
Thanks! As I understand it the DFT is simpler (as in easier to understand the math) than the FFT, but the computational requirements are heavier (O(N^2) vs O(Nlog2(N)), so I think, between the two I'd want to use the FFT – but I am in way over my head here...dlu– dlu2015年12月24日 17:36:36 +00:00Commented Dec 24, 2015 at 17:36
1 Answer 1
I havent used any of the libraries to make the FFT for my personal project, due to complexity. Instead I bought a spectrum chip, which returns 7 frequencies: MSGEQ7 ( 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz ).
Otherwise if you are very keen on using a library, this one is very famous and fast for Arduino processors.
But again, if you dont need to have a precise band and the MSGEQ7 is good enough to detect what you want, go for it.