<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jean-Marc Valin wrote:
<blockquote cite="mid:463A9242.7000709@usherbrooke.ca" type="cite">
  <blockquote type="cite">
    <pre wrap="">I hate to be a talker and not a do-er, but I won't be able to write this
myself, probably someone on the iaxclient team could do it.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Anyway, let me know if/when someone's working on that.

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Hmm, or does that mean the analogue AGC is actually completely
independent from the "real" AGC. Any thoughts?
  
      </pre>
    </blockquote>
    <pre wrap="">It's actually a bit more complicated, because it's more like "AEC -&gt;
Noise Suppressor -&gt; VAD -&gt; AGC", even if the VAD decision isn't used by
the consumer, right.  Because the VAD decision needs to be used by AGC,
so that it isn't raising the gain of background noise (although it
should probably lower the gain when there's any signal higher than it's
threshold).

For AAGC, though, I guess one way to do this would be if you could
somehow "transport" the un-cancelled, un-noise-suppressed energy level
past the VAD decision, and then used that to determine what gain
adjustments to make.  In this fashion, you'd be making your adjustments
based on the information you want:  (a) the actual signal energy before
processing, and (b) VAD decision. 
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I don't see b) as being that important. Could help a bit, but you really
want to use a).
  </pre>
</blockquote>
<br>
I think you want to use both pieces of information, so you're not
raising the level of a signal that's not speech.&nbsp; It's _especially_
important when you're doing EC, of course, because you don't want to
raise the gain on an echo.<br>
<br>
<blockquote cite="mid:463A9242.7000709@usherbrooke.ca" type="cite"><br>
  <blockquote type="cite">
    <pre wrap="">As far as gain changes messing up the rest of the preprocessing chain: 
It would seem to mess up the denoiser, the VAD logic, etc., as well as
the echo canceller.  It might be possible (as I wrote earlier) to give
the filter chain some hints about what the effects of the changes are,
but it probably won't be perfect, because it would be difficult or
impossible to predict the exact response of gain adjustments, and the
delay after which they will actually take effect.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Well, I guess you could:
1) say "freeze!" to everyone
2) increase the analogue gain
3) let everyone know by how much the gain was increased
4) wait a little while (e.g. 100 ms)
5) unfreeze everyone

  </pre>
  <blockquote type="cite">
    <pre wrap="">The AAGC mechanism I implemented, though, was good enough, for some
measure of good enough.  It basically made step-wise adjustments (10% or
20%) every so often, when speex' loudness parameter was above or below
certain thresholds, and it strongly detected speech.  If you use this
mechanism, and pre-set the mixers to be at about 80%, it relatively
quickly gets the gain into a reasonable place once speech is detected. 
It would probably work just as well when EC is involved, as long as EC
and VAD work together well enough such that you don't get VAD
false-positives from echo.  The target "loudness" range here is 4000 &lt;-&gt;
8000, but it could be widened a bit to avoid more adjustments.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
You don't want to make small +-10% adjustments. I would go for +-10 dB
at *least* (probably even 20 dB). Quantization noise issues at 16 bits
per sample aren't worth the trouble of doing smaller steps.
  </pre>
</blockquote>
The thing is, I don't know if mixer controls on most platforms give you
any idea of by how many dB you're changing things, whether the changes
are linear or not, etc -- the mixer controls are just a know with
levels from 0&lt;-&gt;1 (mac, I think), 0-100, or 0-255.&nbsp; I raise/lower
them by 10% or 20% of their full range, so with the 10% adjustments,
you only have 10 steps.&nbsp; That seemed a big enough jump in practice.<br>
<br>
-SteveK<br>
<br>
<br>
<br>
</body>
</html>