Workaround: Creating constant-dB envelope decay using an existing linear decay algorithm

Document created by BrettG Employee on Jan 9, 2014
Version 1Show Document
  • View in full screen mode

Originally authored by Steve L

 

My current project calls for a Peak Programme Meter - a peak-reading level meter with fast attack, slow decay and a logarithmic scale. My system microcontroller reads the level value periodically from the SigmaDSP (an ADAU1701), compares the value to a set of log-spaced thresholds and drives a row of LEDs.

 

In theory, the Sigma end of things should be easy - just use the Peak Envelope detector with an appropriate choice of hold and decay times. However, I have fallen foul of the fact that (as was flagged up here: http://ez.analog.com/message/50275#50275) the Envelope detectors have a linear decay characteristic rather than the more usual RC/constant-dB response. The effect of this is that my logarithmic meter decays ridiculously slowly at the top end of the scale and much faster at the bottom.

 

Further to my earlier posting, I just tried out the scheme using a Peak Envelope External Decay with feedback and - much to my surprise - it worked perfectly!

 

There is an element of "suck it and see" about setting the initial parameters because the SigmaStudio Help specifies the P.E.E.D. control input in dB/s, but we have already established that the decay is linear and therefore the dB/s rate depends on the instantaneous peak output level.

 

My eventual circuit was:

vc_envelope2.JPG

MeterOffset ensures that the decay rate never falls to zero while MeterGain determines by how much the decay rate varies with output level. The feedback gain is tiny because of the need to translate between 5.23 and 28.0 number formats.

 

I was looking for a decay rate of around 9dB/s for my Peak Programme Meter and my initial educated guesses for the parameters - 2 for the offset (28.0 format) and 1.5E-5 for the gain - gave a nice constant-dB/s decay which was just a little too fast. Tweaking the parameters to 1 and 1.0E-5 got it just about right, which is fortunate since that appears to be about as slow as it will go.

 

I don't know whether this method would hold up in a really demanding application, but it looks fine on my short LED-bargraph meter. I have every confidence that the method Bob suggested would also work, and probably offers more opportunities for fine-tuning. In fact, it is directly analogous to a lot of analogue Peak Programme Meter circuits.

1 person found this helpful

Attachments

    Outcomes