I need to get the RMS signal value and controle the attack and decay in db/s. The signal envelope works fine, but I can't control the decay in db/s just linear. I would like to know if there is a way to solve my problem.
Likely you need a quick Attack rate (such as 120 dB/s), and a slower Decay rate (perhaps 20 dB/s). The schematic below compares two envelope detectors -- a plain RMS Envelope block on top, and a RMS Envelope block followed by a homemade Decay stage below. In the two-stage detector, the RMS Envelope block provides the usual Attack rate and Hold time. Set this block's Decay rate as fast as possible (the same as the Attack rate) so that the following stage determines the overall Decay time.
Calculate the gain b according to the desired overall Decay rate (dB/s) with this formula:
b = e^ - [(dB/s) * ln10 / 20 * fs] Example: fs = 48000, dB/s = 20, b = 0.999952
Compare the plain RMS Envelope block's response to that of the two-stage design:
Retrieving data ...