Sounds like software AGC can be implemented with very low performance overhead. So you just get the average of the last 20 samples over 20 seconds then use that to determine the multiplication factor? Would it be worth taking samples over a shorter time to make it more responsive to sudden changes in volume?
You don't want the AGC too "responsive"... 20 seconds is the amount of time it takes the "AGC" to completely-adjust... That's just the time I chose. It's fast-enough to adjust to quiet & loud songs, but slow enough that it doesn't get messed-up by the silence (or fade) between songs.
I assume the MAX9814 board is set for faster AGC time because 20 seconds is slow for a "normal" microphone (for recording, etc.). If you have silence the gain gets turned-up to maximum. Then when sound comes-along you (usually) get distortion until the AGC adjusts, so you want a fast attack time (and a slower release time).
Your LEDs can respond "instantly".
For example, the maximum ADC value is 1023, so I assume your software is "tuned" for peaks around 1023... Let's say the maximum value in your 20-second array is 200, so your readings are on the low-side. You can multiply all of your readings by 5 (or by 1023/200).
Or, if your readings are consistently below 225 you switch to the [u]optional 1.1V reference[/u] and you'll get higher readings. (I do that.) The only tricky thing is if you automatically switch to the lower reference while the effect is running you have to scale-up the old-lower values in the array by a factor of 4.5 (5/1.1).
...Depending on how you do it, the maximum value in the array may not be THE peak, it might be A peak which you happen to save. (I just "save" a reading once per second so what's in the array it's not necessarily the highest peak.)
With the MSGEQ7 you've got 7 readings to deal with so you could make 7 arrays, or average them all together, or just choose a middle frequency-band, etc... Whatever you want to do or whatever works best for you.
In my application I'm not actually multiplying the readings, I'm adjusting the sensitivity by changing the digital reference. For example I have an effect that flashes the light on when the signal is above average and off when below average (the average is my reference). And I have a "VU Meter" effect where the "top" of the meter is the peak value saved in the 20-second delay (the peak is my reference).
...I've got some limits in my algorithm so it doesn't go "totally crazy" when there's no signal.
Either way, you are loosing resolution when you multiply the readings or lower the digital reference level, but it's an effect so accuracy/resolution are not important... You want lot's of LED/lighting action. (And, you have zero accuracy with anything like AGC or variable sensitivity). If you switch to the 1.1V analog reference you are gaining resolution.
The MAX9814 does but it's an already made device with builtin mic. The datasheet seems to refer to both the device and its main chip as the MAX9814. I can't seem to find any information on how to find and use the same chip for a standard audio jack input.
[u]Here is the datasheet for the chip[/u]. It has a minimal (nominal) gain of 40dB (100) so you'd have to attenuate the signal by about 40dB, which is sort-of "Mickey Mouse". (You can attenuate with a voltage divider, 2 resistors.)
You can probably find an AGC chip/circuit for line-level audio signals and lower nominal gain.