I LOVE those National Semiconductor books!
It seems simple to me: if you show engineers how to use your chips they will use them, if you don't, you won't sell any.
Spec, thanks for the interesting circuit idea. I'll have more to say about that but I think that's a very good way to do this.
...but...
I thought I got it figured out:
View attachment 98502 View attachment 98503
I have a buffer / isolation amp on the input to avoid loading down the audio signal. It is AC coupled with a pretty big cap, and the 1K will ensure that any charge on the cap can not damage the op amp on power down. Next it goes into a R-D-R network that I think helped the circuit perform faster, it clips the positive peaks with a Schottky diode that I believe keeps the following stage from driving itself far into the negative output. Without that R-D-R it takes a while for the output to return to positive, so some of the fast peaks are lost while the op amp output recovers. Without it, I could easily see the start of the positive sine waves clipped like how an AC dimmer circuit works, and the response falls off a lot at 20KHz, even though its a 15 MHz op amp.
The middle stage has a cap for negative feedback. I didn't need it, but I will put that in the PCB; I might need it to kill oscillations. (I don't think I have any, but on the solderless breadboard there is a lot of noise that could be hiding something.) The middle stage does the hard work of rectifying. D3 is the main rectifier and it's in the feedback loop to effectively null out most of the errors of the 350mV diode drop. I had to loose the transistor rectifier/driver because it was pointed out by audioguru that it couldn't handle the reverse voltage. (In hindsight, I guess I could have just added a diode before the base.) I looked into a Darlington transistor, which could just handle a reverse 12 volts but that was pushing it, and I'd have speed-killing 1.2 volt diode drop that the op amp's slew rate had to compensate for. I also looked into MOSFETs, they could also handle the voltage but I didn't have any PMOSFETS available and not sure how I would have hooked that up.
Either way, this version responds fast enough. D4 is in there so whatever is left of the positive input peak (which is negative here) will be cut down to a lower gain after 350mV is reached and will help prevent the op amp from going hard negative, again for speed.
From the rectifier, it drives a fairly big 33uF cap so there will be a loooonnnng peak hold time. Again I was worried about a big charge on the cap when the power goes off (when audio may likely pop), so D17 will drain most of that charge through the dying +15 supply, and whatever's left has to get through the 10K resistor before it can damage the final op amp stage.
I drew up a clever (at least I thought) idea to enhance the drive current to the big cap using a transistor so it could respond faster, but I thought I should test this out first and apparently it didn't need any more work. Worst case, using a 24 volt peak-to-peak input signal at 20,000Hz, I was catching the peaks. The charts I attached show the response from 20 Hz to 20,000 Hz, and it's fairly flat. Yes, you can see some variation there but 1) I don't have fancy lab equipment in my basement and 2) we are looking at a chart with linear data. If you convert it to a log scale (which a dB meter is supposed to be), the variation seen converts to a small fraction of a dB - far too small to be noticed by the output meter with 4dB resolution. (For reference, I used a 22uF cap, didn't have 33uF with enough voltage rating.)
So the frequency response is good at the worst-case maximum input. The other concern is reasonable accuracy at the lower levels. That is where the precision of the rectifier is critical. At 8, 2.4, and 800mV it appears pretty much the same, with a bit of rolloff at 20KHz, but still a fraction of a dB. By the time I got to the 240mV level (about -35dB), I was running into the noise floor of my solderless breadboard. I'm hoping for a -40dB reading that is valid, but I'll have to wait until I can test a soldered version.
So I was 'scoping it out and playing with the audio input levels, and saw a pretty cool thing going on. When the audio is at a high level, I can see the output of the op amp (pin 8) driving the rectifier and cap. It produces a steady stream of pulses that start at just before the next peak comes along as the cap has lost a little juice. As soon as it charges the cap back to full value, the op amp shuts off and the pulses disappear. If I turn the output down lower, for the next two or three seconds there are no pulses at all, until the op amp "decides" that the decaying voltage is getting too low. Then the pulses start up again. It's like there is a digital processor in there making PWM signals to control this thing. (OK, I am a nerd if I found this interesting).
So getting back to where I started, I think the circuit that spec has shown (post#40) is quite interesting. Whenever the comparator sees the input is higher than the output voltage, it turns on a transistor to dump more current into the cap. When it's satisfied, it turns off. I don't really know what could be simpler!
Maybe now I have to scrap this whole thing and start with that #40 post...
(sigh) I was going to start working on a voltage tripler for 48V phantom power.