If you are going to use an ADC and microprocessor anyway, you might want to consider letting them do more of the work. You could provide a preamp to get the signal in range of the ADC, and let software do the rest.
That way , the software can handle attack/decay time constants, and most importantly it can do FFT spectral analysis to get frequency information, if you later decide you want it.
Of course, this will mean that you will need to sample at a much higher rate and deal with the flow of data. You don't mention the capabilities of the uP you have in mind... can it handle this kind of workload?
Bob Masta DAQARTA v4.00 Data AcQuisition And Real-Time Analysis
Scope, Spectrum, Spectrogram, Sound Level Meter FREE Signal Generator Science with your sound card!
Since you are going to ADC it anyway, simply capacitivly couple the audio signal into the ADC. Insure that the max peak of the audio signal is within the ADC range.
Convert to digital then detect and hold the maximum values for a determined length of time. Use the numerical value in this hold register to control what ever.
Each converted value is compared with the previously held value and updates the held value if larger. A timer starts or restarts on each hold update. The register is cleared on the expiration of the timer. This creates a running peak of the audio signal.
The peaks values of most audio signals will be emphasized in the bass region. This can be tailored with simple filtering if needed which isn't likely.
Yeah you can clamp it but then you loose that and higher values as peaks. The whole idea is to convert the peaks to numbers not to clip them off.
There's really no need to clamp it. The processor input will have internal "diodes" that will keep the voltage from exceeding the rail voltage plus a little. Likewise the input voltage won't go below ground. A series resistance should be added to limit the input current and a shunt resistance added to keep the DC level from shifting up due to rectification by these clamps.
Well, if there is an internal diode from the input to the negative rail, it will keep the voltage on the input from going below ground, ignoring the diode drop, of course.
Now, if you capacitively couple to the input, this diode will rectify the negative going portion of the audio signal and charge the capacitor, positive towards the input. This will offset the zero base line in the positive direction and screw up the peak detection. A judicious resistance to ground with an appropriate series resistance will limit the current and drain off this offsetting charge. It ain't rocket surgery!
One thing to remember is that cmos inputs are usually prone to latch-up disease. So, if the output goes higher than the positive voltage input of the IC, you can end up with a triggered SCR between Vcc and ground. Not good.
So, having a way to prevent this is a good thing, and generally consists of a diode from the input to the positive rail. For digital inputs, I believe most microprocessors use an internal diode. However, I'm not sure about analog inputs, and would not want to risk it, particularly when a cap from an external input can easily cause this situation, and the solution is so simple.
The PIC stuff has internal protection diodes on the inputs. As far as I know all of their processors are so protected on the IO ports whether configured analog or digital. For a typical A/D input, see the PIC16F676 Data Sheet page 47. There should be no trouble driving a few milliamps into these diodes clamping off a signal without any external diodes.
I've never yet seen one latch up doing this. That's probably why the diodes are there.
That is a microchip appnote, so somebody there appears to believe it can happen, at least in some cases. Their summary suggests that it'll be a problem if the input in question is driven higher than Vcc at startup, which is a real possibility with an audio input which is driven externally.
On the other hand, I just spent 20 minutes trying to get a PIC12F675 to latch up, and was not able to make it happen. So, maybe it isn't such a big deal. The appnote I posted pointed to a couple of circumstances, like inductive loads, driving power mosfets. Perhaps the spike has to be at exactly the right time.