Electrical – Auto Audio Gain Control IC for normalized audio from line level input

arduinoaudiofrequencygainmicrophone

The problem I am having is like this:
I am using an aux cord line level output from a smartphone to a MSGEQ7 chip which samples the frequencies and splits it into 7 channels which can be seen as an analog voltage from 0V to Vin based on that frequencies strength. 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz. (Sparkfun info) I am using an Arduino to then take the output and display it on 7 bar graphs.

Now the problem… Unless the output is at around 80% volume, any song playing will either not be strong enough to be displayed, or too far over and will be clipping the top of each bar graph. Unfortunately I don't own an oscilloscope so I can't give the peak to peak voltage. This would be ok if I could always leave the volume at 80% but in this case its much easier to turn down the voltage on my phone rather than going over to the speakers and turning down or up the preamp knob. Ideally at any input volume the signal would be either boosted or decreased to the sweet spot.

I've researched a bunch of different solutions from diode/npn circuits to multi op-amp circuits, to Compandor (compressor/expander) chips like the NE570 (but far too expensive), but I'm not sure what would actually work for my solution. I don't need high fidelity, but I also don't want to lose sensitivity for high and low frequencies. (Is this normalization or dynamic range compression?) I have used the Adafruit auto-gain microphone which uses a MAX9814 which offers an output of 2V peak to peak and a DC offset of 1.25V and it works great, but I'd also like to be able to use an aux cord in.

Thanks ahead for your answer

Best Answer

I think you have an XY problem here, in that I suspect you are rendering your bars as linear data, as you have discovered that does not work so well.

Try reading from the ADC, then taking the log of the adc measurement and driving your bargraphs from that, you will probably find that such a scale is much more useful.

Another possibility, generate PWM from the micro, lowpass it use it to control the gate of a jfet as a variable resistance, or even an LM13700 OTA.