More interestingly, I’m using complex_to_mag to demodulate a 32K sps
baseband channel as AM, then filtering/decimating the resulting audio.
If I set the AGC reference value (second parameter) to anything above
0.2 (including the default 1.0), the audio comes out distorted. It
sounds like clipping.
For a reference value, of say, 0.5, complex_to_mag should be outputting
peaks at |0.5+0.5j| which is ~0.71.
I don’t have the agc code in front of me, but the definition of the
setpoint in important. Assuming you make the setpoint 1, and that the
agc is setting the average (of either I or Q) to the setpoint, the
amplitude will go from 0 to 2, since this is AM. You will need to
subtract 1 so that you get a signal of +/- 1 for the audio sink.