RGB LED audio spectrum analyzer – Bandpass or FFT

audiofilterledrgbspectrum analyzer

I'm about to build a coffee table which has a RGB LED matrix build in it just like in this video.
https://www.youtube.com/watch?v=4NJDgvV8RZw

I want the matrix to display an audio spectrum that should be calculated in real time from a variable audio source over a 3,5mm audio plug. ( e.g. smartphone, PC, mp3 player )

It sould also just display random and/or programmed visuals patterns. ( not related to the audio input )

So i thought using an AVR microcontroller as the main unit of this project.

The mcu will be programmed once, and does not have to communicate with other devices.

Buttens will be used to switch between modes and/or annimations.

So the basic idea is there, but there are a few things that I'm not shure about:

  1. Should I build a bandpass filter board to get the spectrum data and process it from there on with the mcu or go for the FFT- ( complete-software- ) solution ? Which one is faster / more effective ? Does the speed difference matter in this kind of project ?
    ( Yes I know there are a couple of questions with the same topic, and I've read a few of theml, but I think the answers wheren't specific enougth for me )

  2. How do I choose the amount of bands for my spectrum analyzer ( collumns of the matrix ) ? Does it matters how many bands I choose ( since I want to design the RGB LED matrix driver board and the table with its dimensions based on my selection ) ?

Thanks for your help and please exscuse my bad english.

Best Answer

Personally I would go (and have in the the past gone) the FFT route. However I wouldn't use an 8-bit AVR, I'd use something somewhat faster.

My personal weapon of choice is the PIC32, which has more than enough power to do a good job of the FFT, but there are other good choices besides that - such as one of Atmel's 32-bit ARM chips (SAM3X for instance, like in the Arduino Due), or many of the other ARM chips that there are out there.

The trick with FFT is you need a good fast sample rate and enough memory to store a complex sample buffer. Say you want 1024 samples (which would give you 512 FFT buckets to play with), at 16 bits per sample, plus 16 extra bits for the complex FFT component, you're talking a minimum of 4KB of RAM just for the sample storage. Also, if you want it to be smooth then you want to be using DMA to read the samples in to one buffer while running FFT on another buffer, so a ping-pong double-buffer would increase that to 8KB.

With FFT you get half the number of buckets, or frequency ranges, as you have samples. The frequency range is also half the sample rate. So if you have 1024 samples recorded at 48KHz, that gives you a frequency range of 0-24KHz, with (24000/512=) 46.875Hz per bucket.

Reducing to 128 samples would give you 64 buckets, each at 375Hz per bucket.