You might search comp.dsp for relevant threads. There have been a few. A simple explanation of an AGC implmentation goes something like this: 1) You will detect the peak levels. 2) You will use the peak levels to control the gain according to some simple gain formula related to the control input to that formula. Something like Gain=1/(A+B*control) where control is a function of the time history of the peaks so that if the peaks and control are zero, the gain is maximum and if the peaks and control are very high, the gain is minimum. It does make sense to set a maximum and minimum. You set A and B according to your situation, scaling, gains, etc. 3) You decide how fast the AGC will react to a sequence of peaks - either higher peaks or lower peaks. A very normal method is to use "fast attack" and "slow decay" under the assumption that high peaks are likely to be followed by more high peaks and more than a few low peaks are necessary to predict a longer sequence of quiet passages. You will pick times (or filter coefficients) for attack and decay. 4) You will implement a filter that generates the fast attack / slow decay control signal. It could be as simple as: if peak(k)>control control(k) = control(k-1) + C*(peak(k) -control(k-1)); where C might be 0.90 endif if peak(k)<control control(k) = control(k-1) - D*(control(k-1) - peak(k)); where D might be 0.50 endif The idea is to add 90% of the difference on the increasing side and to subtract 50% of the difference on the decreasing side. You pick the numbers to use to suit your application. Fred
Fast Attack Slow Decay 解释
最新推荐文章于 2024-06-25 20:32:06 发布