Reply by Ben Bradley May 29, 20042004-05-29
On 27 May 2004 12:06:12 -0700, hartman@onetouch.com (Richard M.
Hartman) wrote:

>I am a software developer, not really an audio specialist. I need to >implement an AGC for 8Khz 16-bit digital audio (under Windows). I >tried searching for AGC algorithms using Google, but the few mentions >I saw were discussed using audio techie language and I do not >understand how to convert this into practical code. > >For ex. the most promising one seems to be this posting: >http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=378ED9ED.2B59%40iowegian.com&rnum=8 > >It mentions "simply calculate I^2 + Q^2, take the log of that, then >multiply by 0.5.". I understand that we're taking the log to get into >the decibels domain, but other than that I am lost, not knowing what I >or Q represent. Determing what the "ideal" signal level should be >later on in the discussion is another mystery.
As others have said, these are for RF/IF signals, and not useful. In Audio you generally don't look at the phase to get the level. In audio compression/ALC circuits/systems there are three basic ways to detect level, peak (or almost equivantly, peak-to-peak/2), average, and RMS. A particular one will be used depending on application - peak is used for a "limiter" when the signal must not go above an absolute level such as the modulation of a transmitter. RMS is equivalent/proportional to power, and corresponds most closely to loudness as heard by the ear.
>Can anybody point me to a more practical explanation, or better yet >some source code I could make use of (or attempt to adapt)?
Search on ALC (Automatic Level Control) and compression (dynamic range compression of audio signals, not psychoacoustic data reduction such as MP3). Look for the operations of audio compressors such as the (infamous) Alesis 3630 - there should be a .pdf-file manual somewhere on the net that eplains attack-release-threshold-ratio and stuff, and what settings are appropriate in what situations. rane.com has full documentation on their products (including at least one model compressor) online.
>-Richard M. Hartman >hartman@onetouch.com > >186,000 mi/sec: not just a good idea, it's the LAW!
----- http://mindspring.com/~benbradley
Reply by Phil Frisbie, Jr. May 27, 20042004-05-27
Richard M. Hartman wrote:

> I am a software developer, not really an audio specialist. I need to > implement an AGC for 8Khz 16-bit digital audio (under Windows). I > tried searching for AGC algorithms using Google, but the few mentions > I saw were discussed using audio techie language and I do not > understand how to convert this into practical code. > > For ex. the most promising one seems to be this posting: > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=378ED9ED.2B59%40iowegian.com&rnum=8 > > It mentions "simply calculate I^2 + Q^2, take the log of that, then > multiply by 0.5.". I understand that we're taking the log to get into > the decibels domain, but other than that I am lost, not knowing what I > or Q represent. Determing what the "ideal" signal level should be > later on in the discussion is another mystery. > > Can anybody point me to a more practical explanation, or better yet > some source code I could make use of (or attempt to adapt)?
I have some simple AGC functions in my free and open source library HawkVoiceDI. -- Phil Frisbie, Jr. Hawk Software http://www.hawksoft.com
Reply by Fred Marshall May 27, 20042004-05-27
Magnitude squared -> Mag^2 is the result.

0.5*log(Mag^2) is log(Mag)

You can probably deal with that, eh?

Fred

"Richard M. Hartman" <hartman@onetouch.com> wrote in message
news:a96d1ecd.0405271106.19fcbd81@posting.google.com...
> I am a software developer, not really an audio specialist. I need to > implement an AGC for 8Khz 16-bit digital audio (under Windows). I > tried searching for AGC algorithms using Google, but the few mentions > I saw were discussed using audio techie language and I do not > understand how to convert this into practical code. > > For ex. the most promising one seems to be this posting: >
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=378ED9ED.2B59%40iowegian.com&rnum=8
> > It mentions "simply calculate I^2 + Q^2, take the log of that, then > multiply by 0.5.". I understand that we're taking the log to get into > the decibels domain, but other than that I am lost, not knowing what I > or Q represent. Determing what the "ideal" signal level should be > later on in the discussion is another mystery. > > Can anybody point me to a more practical explanation, or better yet > some source code I could make use of (or attempt to adapt)? > > -Richard M. Hartman > hartman@onetouch.com > > 186,000 mi/sec: not just a good idea, it's the LAW!
Reply by Leon Heller May 27, 20042004-05-27
"Richard M. Hartman" <hartman@onetouch.com> wrote in message
news:a96d1ecd.0405271106.19fcbd81@posting.google.com...
> I am a software developer, not really an audio specialist. I need to > implement an AGC for 8Khz 16-bit digital audio (under Windows). I > tried searching for AGC algorithms using Google, but the few mentions > I saw were discussed using audio techie language and I do not > understand how to convert this into practical code. > > For ex. the most promising one seems to be this posting: >
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=378ED9ED.2B59%40iowegian.com&rnum=8
> > It mentions "simply calculate I^2 + Q^2, take the log of that, then > multiply by 0.5.". I understand that we're taking the log to get into > the decibels domain, but other than that I am lost, not knowing what I > or Q represent. Determing what the "ideal" signal level should be > later on in the discussion is another mystery. > > Can anybody point me to a more practical explanation, or better yet > some source code I could make use of (or attempt to adapt)?
I and Q are 'in-phase' and 'quadrature' signals. These are generated in a radio receiver by a suitable local oscillator with quadrature outputs, and mixers, converting the input RF signal into I and Q baseband signals. This isn't really relevant to audio AGC. Leon -- Leon Heller, G1HSM http://www.geocities.com/leon_heller
Reply by Richard M. Hartman May 27, 20042004-05-27
I am a software developer, not really an audio specialist.  I need to
implement an AGC for 8Khz 16-bit digital audio (under Windows).  I
tried searching for AGC algorithms using Google, but the few mentions
I saw were discussed using audio techie language and I do not
understand how to convert this into practical code.

For ex. the most promising one seems to be this posting:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=378ED9ED.2B59%40iowegian.com&rnum=8

It mentions "simply calculate I^2 + Q^2, take the log of that, then
multiply by 0.5.".  I understand that we're taking the log to get into
the decibels domain, but other than that I am lost, not knowing what I
or Q represent.  Determing what the "ideal" signal level should be
later on in the discussion is another mystery.

Can anybody point me to a more practical explanation, or better yet
some source code I could make use of (or attempt to adapt)?

-Richard M. Hartman
hartman@onetouch.com

186,000 mi/sec: not just a good idea, it's the LAW!