On 12/10/13 10:47 PM, Kristoff Bonne wrote:
>> Do you need AGC, or will a simple "set and forget" gain control do
>> the trick?
>>
> Well, a "set and forget" value would be nice to start with but I think
> I can code that myself. :-)
My point was to ask the question of whether you were overthinking this.
:) How many of us use AGC on the audio between FM links?
>
>
> It's the AGC that is the more difficult part. I think it should be
> something like this:
> - apply a minimal "squelch" treshhold
> - if the threshhold is exceeded for a sufficient number of samples,
> calculate the average audio-level over (say) the last second
> - calculate a amplification-value based on this
> - multiply all incoming audio with that value
>
Something like that.
>
> The more difficult part will probably be on how fast to make the AGC
> addapt itself. Also, as rtl_fm does not seams to apply a LPF
> everything below 300 Hz, I probably also need to add that too to that
> the AGC does not get confused by that.
Actually a constant tone would limit the range of the AGC, so that would
help, if anything. Or you could be clever and once you'd got a sense of
the overall audio level for the transmission, look at the energy below
300 Hz, and if there was a tone, hold it at constant level to avoid AGC
pumping. :) Actually I thought there was already a 300 Hz HPF in tlb.
Have to double check that one. Though if you put your AGC after that,
you could make it selectable for all inputs.
>
>
> Another thing is that I have just noticed that the demodulated audio
> from rtl_fm has a terrible DC offset. My guess it is related to drift
> off the tuner in the dongle (which varies over time as these tuner are
> quite sensitive to temperature). I probably will need to get rid of
> that before any processing off the audio can be done.
> Grr!!! Why do the details of implementing stuff aways make things so
> more difficult then first thought! :-(
A HPF would eliminate this as well as stray CTCSS tones (DC is 0 Hz
afterall :) ).
>
>
> BTW. Thanks for the hint on using the eventmanager in tlb to set up a
> connection between two TLB devices on startup. It surely is usefull!
Works a treat, and you're welcome. :)