Help with adjustable diode clipping detection/indication

Started by coreybox, December 10, 2010, 09:34:18 AM

Previous topic - Next topic

coreybox

Background Information

I'm in the process of designing a stereo headphone amp, for the purpose of a wired monitoring system. There are three "modules"/boards:

balanced input -> digital volume control (micro-controller and TI PGA2310) -> amplifier

The balanced input and amplifier design is done. Basic functionality of the volume control mechanism has been breadboarded. I have a working headphone amp.

The Question

As a safety precaution, I want to include a limiter in my design. I'd also like an adjustable threshold.

I want low parts count, but I also want it to sound good. Having a digital volume section can really help this. My initial thought was to sample the signal with the processors ADC. Then I could adjust the volume as needed, and chance the threshold digitally. Unfortunately, I'm not sure this will be as quick as I'd like... and it will also be pretty code intensive (RMS/peak, etc). Still an option but....

My second thought is to use clipping diodes. This works well from a parts count and fast/safe standpoint, but degrades the audio quality. But can I combine the two ideas?

Here is a picture of (one-side) of the adjustable diode clippers:



This will provide the protection, but sound bad when it clips. What I want to do, is add some automatic gain control. I want to accomplish this by detecting when the signal clips, and reduce the volume until it no longer is clipping.

To do this I need a control signal from the clipping circuit to the micro-controllers ADC. The ADC accepts a range of 0-5v. So when the diodes are not clipping, I want it to be at one extreme, and when they are at the other.

The spot in between the two diodes seems like an ideal spot for this, but the ADC reads random values since the net is floating. I can't ground it with a resistor, as it changes the adjust-ability of the clipping threshold via Vcc (15v).

Any ideas as to where I can tap off this circuit (and any components I'd need to add) so that I can get a good control signal as to whether the diodes are clipping the signal or not, yet still retain the adjustable threshold?

Last thought: One idea I've had was that a DPST relay could be added in-between the diodes. This could switch between 0 and 5 volts. I don't think they make relays that would be triggered by such small signals though.

thanks guys!
Corey

Nasse

Old magazine had simplish two stage clipping circuit, first one had lower treshold diode pair and series resitor and indicator led, and after that, two diodes in series pair clippng with harder limit, clipping was adjusted by gain stage before clippers

then this is done with analog switches if I remember http://www.elektor.com/magazines/2010/july-047-august/dynamic-limiter.1392487.lynkx
  • SUPPORTER

ashcat_lt

Now, I don't know from nothing, but it seems like any mechanism that has to first detect the over voltage and then turn the gain down is going to have some inherent latency in both directions.  That is, it take a finite period of time before it clamps down - and in the meantime whatever you're trying to protect down the line isn't protected - and also when it lets go. 

I think you've got two options:

1)  Use the diodes and let the "sounds bad" thing be redundant with the clipping indicator LED.  It's supposed to sound bad when you're over-driving something and I think most people expect that.  If you want it to not sound quite so bad, maybe you could put a cap to ground there.  Maybe just across the "bottom" diode, so that it only rolls off the top end only when clipping is actually happening?

2)  Find a way to delay the signal between the detection point and whatever you're trying to protect.  Delay it enough to allow your detection portion to do it's thing.  This is like the look-ahead function in the digital compressors we have "In The Box".  Nobody's gonna miss millisecond or two here or there.

johngreene

Quote from: ashcat_lt on December 10, 2010, 08:56:26 PM
Now, I don't know from nothing, but it seems like any mechanism that has to first detect the over voltage and then turn the gain down is going to have some inherent latency in both directions.  That is, it take a finite period of time before it clamps down - and in the meantime whatever you're trying to protect down the line isn't protected - and also when it lets go. 

I think you've got two options:

1)  Use the diodes and let the "sounds bad" thing be redundant with the clipping indicator LED.  It's supposed to sound bad when you're over-driving something and I think most people expect that.  If you want it to not sound quite so bad, maybe you could put a cap to ground there.  Maybe just across the "bottom" diode, so that it only rolls off the top end only when clipping is actually happening?

2)  Find a way to delay the signal between the detection point and whatever you're trying to protect.  Delay it enough to allow your detection portion to do it's thing.  This is like the look-ahead function in the digital compressors we have "In The Box".  Nobody's gonna miss millisecond or two here or there.
Technically the problem you are trying to describe is that the 'mechanism' needs to know ahead of time the potential for an over voltage situation so it can reduce gain and things will not sound bad. This is where this 'latency' you describe comes into play. I think you will find that if you do a multi-breakpoint limiter(or 'soft' limiter) that it will not sound all that bad. Basically several diodes in parallel with different resistances in series in the most simplistic implementation. In fact it may not even be noticeable in the environment you describe. "Squashing" peaks is something tubes have done for a long time and people actually like the effect it has.
I started out with nothing... I still have most of it.

PRR

> but it seems like any mechanism that has to first detect the over voltage and then turn the gain down is going to have some inherent latency

Yes, but.

If your system overloads without gross obnoxious sound, several milliSeconds of clipping is NOT generally noticable (and is preferable to sustained clipping). In most program, a few-mS Attack time constant is sufficient.

There are systems with gross overload. Early film-sound recorders "CLANGED" when the light-valve was slammed. Even so, fast-reacting limiters made this system very successful.

There are systems where any overload is a demerit. In radio broadcasting, overmodulation splatters hash into adjacent channels. The licencees of those channels may complain that you are crapping-up their signal. Polite broadcasters take great care to avoid even minor offense. The BBC developed a limiter with a few-mS (or even shorter) delay on the main signal, so that by the time signal got out the side-chain had anticipated the correction and there was zero overshoot.

But these issues are quite apart from what coreybox is trying to do.

In live performance, clipping is NOT majorly objectionable to the musicians yet DOES INcrease hearing damage. Clippers are bad. (And the cheapest clipper is an under-powered amplifier.)

A CPU controller gain scheme is certainly possible. It is NOT easy to make it work well. CPU speed is part of it, but also the reaction of the performers to different limiting strategies is very complex, and best-known in analog terms.

If you want to make music instead of tinker code, get an RNC compressor. I know this is a DIY forum, but a musically satisfying yet effective limiter is a time-sink. (I've sunk decades into ideas.)
  • SUPPORTER