DSPRelated.com
Forums

How to implement AGC using DSP software to get better speech quality in tele communication system?

Started by Judy March 2, 2004
I am going to design a AGC module in TI TMS320C5409 DSP to improve
speech quality ,how should I design the algrithm  and parameters? Did
anyone have done similar thing?I will really appreciate for some code
or materials
On a rolling basis, extract the peaks in the speech waveform
and use to calculate the gain.

If you were to do this for every peak, and then adjust the
gain of the peak you'd just measured, it seems to me that
you'd have a pretty nifty speech compressor.

"Judy" <xu_fang88@vip.163.com> wrote in message
news:69fa0d66.0403012127.4fce8d17@posting.google.com...
> I am going to design a AGC module in TI TMS320C5409 DSP to improve > speech quality ,how should I design the algrithm and parameters? Did > anyone have done similar thing?I will really appreciate for some code > or materials
"Judy" <xu_fang88@vip.163.com> wrote in message
news:69fa0d66.0403012127.4fce8d17@posting.google.com...
> I am going to design a AGC module in TI TMS320C5409 DSP to improve > speech quality ,how should I design the algrithm and parameters? Did > anyone have done similar thing?I will really appreciate for some code > or material
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
"Airy R. Bean" <airy.r.bean@lycos.co.uk> wrote in message
news:c22hp7$1obr39$1@ID-217727.news.uni-berlin.de...
> On a rolling basis, extract the peaks in the speech waveform > and use to calculate the gain. > > If you were to do this for every peak, and then adjust the > gain of the peak you'd just measured, it seems to me that > you'd have a pretty nifty speech compressor. > > "Judy" <xu_fang88@vip.163.com> wrote in message > news:69fa0d66.0403012127.4fce8d17@posting.google.com... > > I am going to design a AGC module in TI TMS320C5409 DSP to improve > > speech quality ,how should I design the algrithm and parameters? Did > > anyone have done similar thing?I will really appreciate for some code > > or materials >
I've cross posted this to uk.radio.amateur as Airy seems to be their resident idiot and I am sure they would like to follow this thread. Airy, your idea tells me that you have never implemented even the simplest of DSP functions or, I suspect, even designed an analogue speech compressor. Naive is the word that springs to mind. To be effective, a speech compressor needs to increase the average power in signal, not simply act as a gain control. How are your studies of the Dirac function, old fruit? Chimera
Airy R. Bean wrote:

> On a rolling basis, extract the peaks in the speech waveform > and use to calculate the gain. > > If you were to do this for every peak, and then adjust the > gain of the peak you'd just measured, it seems to me that > you'd have a pretty nifty speech compressor.
You will achieve perfect uniformity in this regard if you divide each sample by itself before sending it to the DAC, thus insuring that all peaks have the same value. Just be aware that Super Auto-Normalizing Gain Stabilization (SANGS, for short) increases the low-frequency content. Sound quality might be improved by using a differentiator between the SANGS code and the DAC. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Judy wrote:

> I am going to design a AGC module in TI TMS320C5409 DSP to improve > speech quality ,how should I design the algrithm and parameters? Did > anyone have done similar thing?I will really appreciate for some code > or materials
Judy, There have been several threads in the not very distant pass addressing this question. A compressor should have a rather fast but not instantaneous attack time, a slower decay, and a maximum gain that won't amplify noise up to voice level during supposed silences. The actual values that control these parameters can be determined experimentally; the important issue is writing "knobs" for them into the code. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
RU suggesting that it's a known technique?

"Jerry Avins" <jya@ieee.org> wrote in message
news:40450274$0$3069$61fed72c@news.rcn.com...
> Airy R. Bean wrote: > > On a rolling basis, extract the peaks in the speech waveform > > and use to calculate the gain. > > If you were to do this for every peak, and then adjust the > > gain of the peak you'd just measured, it seems to me that > > you'd have a pretty nifty speech compressor. > You will achieve perfect uniformity in this regard if you divide each > sample by itself before sending it to the DAC, thus insuring that all > peaks have the same value. Just be aware that Super Auto-Normalizing > Gain Stabilization (SANGS, for short) increases the low-frequency > content. Sound quality might be improved by using a differentiator > between the SANGS code and the DAC.

"Airy R. Bean" wrote:
> > RU suggesting that it's a known technique? >
Sure, Jerry has the patent on the process. For controlling gain this will beat all other hands down. The only drawback is that its computationally expensive with all those divisions. -jim
> "Jerry Avins" <jya@ieee.org> wrote in message > news:40450274$0$3069$61fed72c@news.rcn.com... > > Airy R. Bean wrote: > > > On a rolling basis, extract the peaks in the speech waveform > > > and use to calculate the gain. > > > If you were to do this for every peak, and then adjust the > > > gain of the peak you'd just measured, it seems to me that > > > you'd have a pretty nifty speech compressor. > > You will achieve perfect uniformity in this regard if you divide each > > sample by itself before sending it to the DAC, thus insuring that all > > peaks have the same value. Just be aware that Super Auto-Normalizing > > Gain Stabilization (SANGS, for short) increases the low-frequency > > content. Sound quality might be improved by using a differentiator > > between the SANGS code and the DAC.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Thank you so much,Fred. I will follow your advice to design the
module.

I am not sure if I can do it well.I searched the net and find many
company that provide the DSP AGC module,such as "spiritcorp". It seems
that only professional DSP companies can design an good-working AGC
module.I wonder if my
AGC module will  improve speech quality notablely. Or if I should buy
one?:-)


"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message news:<dfCdnfKV9ILhSNnd4p2dnA@centurytel.net>...
> "Judy" <xu_fang88@vip.163.com> wrote in message > news:69fa0d66.0403012127.4fce8d17@posting.google.com... > > I am going to design a AGC module in TI TMS320C5409 DSP to improve > > speech quality ,how should I design the algrithm and parameters? Did > > anyone have done similar thing?I will really appreciate for some code > > or material > > 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
Hi Fred,

"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message
news:dfCdnfKV9ILhSNnd4p2dnA@centurytel.net...
> 4) You will implement a filter that generates the fast attack / slow decay > control signal. [...]
It always seems strange to me that AGC is done this way in DSP, just like it is in analog circuitry. Wouldn't it be less, uhm, harmonically violent, to delay the stream by half a second or so, and use this lookahead buffer to find the highest upcoming peaks, so that you could generate a slow attack / slow decay gain control signal that accommodates them on the output?