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

  • \$\begingroup\$ Welcome to EE.SE. What you are learning is that your ear has a logarithmic response to volume but your micro's input is linear. You need to get a logarithmic amplifier between your signal and your analog input. \$\endgroup\$
    – Transistor
    Jun 30, 2017 at 18:06
  • \$\begingroup\$ Precisely. How would the amplifier be controlled? Would there have to be some type of feedback to control gain? \$\endgroup\$ Jun 30, 2017 at 19:12
  • \$\begingroup\$ Have a look at giangrandi.ch/electronics/vu-meter/vu-meter.shtml which shows a passive VU meter. If you were to omit the capacitor would it do what you want? \$\endgroup\$
    – Transistor
    Jun 30, 2017 at 19:24
  • \$\begingroup\$ In what way is the NE570/71 too expensive? - It is only a couple of dollars, not much more than the Maxim part. It is obsolete though. The MAX9814 only has 20dB of control range in its AGC. \$\endgroup\$ Jun 30, 2017 at 20:47
  • \$\begingroup\$ Well the NE570 is $7.56 CAD (compared to $2.34) which is more than I'm willing to spend. if there is a solution which costs far less I'd be more interesting exploring it vs. the other. \$\endgroup\$ Jul 2, 2017 at 3:54

1 Answer 1


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.

  • \$\begingroup\$ Thank you for the reply. Well, the values I receive before any analyzation on the Arduino are too small to even have a reasonably accurate response. The noise created when not playing any music is still equal to playing a song at a 40% volume. Therefore prior to entering the msgeq7 gain should be added. Does this make sense? I believe the msgeq7 has a linear output to the audio input \$\endgroup\$ Jul 2, 2017 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.