I wired up the Teensy audio library's FFT to my APA102 LED lamp.

I wired up the Teensy audio library’s FFT to my APA102 LED lamp. Here’s the code: http://git.io/Rz17Ww I need to find some code for good automatic gain control and/or dynamic range compression. I’d like it to react well regardless of the volume level. Anyone have any they’d suggest?

Originally shared by Jason Coon

I added reaction to music to my new LED lamp.
http://www.youtube.com/watch?v=YQbqccvnx4E

The teensy audio board has an auto gain control. But I think for your sketch you don’t need the audio board only the teensy. I would be also interested in a software agc.

Thanks, Lars. I have a Teensy audio board but haven’t tried it yet. I’ll investigate its AGC.

I have tried Paul’s suggestion for simple software AGC here: https://forum.pjrc.com/threads/24793-Audio-Library?p=39585&viewfull=1#post39585

“… perhaps compute an average by just summing up the samples (inverting the negative ones, of course). Or maybe you’d square them and add them all up? Then you might adjust your gain slightly if the average is above or below the target, which of course would be a private member variable, and multiply all 128 samples by the gain setting…”

I’ll post what I’ve tried, but it’s likely too simple and doesn’t seem to respond well. I assume I need something more advanced that uses an adjustable attack, release, etc. Or I’m just doing it wrong. :slight_smile: