rtl_fm Squelch Questions

Martin McCormick martin.m at suddenlink.net
Sat Feb 11 13:58:34 UTC 2017


=?UTF-8?Q?Marcus_M=c3=bcller?= <marcus.mueller at ettus.com> writes:
> Hi Martin,
> 
> I'll just address the question /what does the rtl_fm squelch do?/ very
> shortly: from rtl_fm.c
> 
>         /* power squelch */
>         if (d->squelch_level) {
>                 sr = rms(d->lowpassed, d->lp_len, 1);
>                 if (sr < d->squelch_level) {
>                         d->squelch_hits++;
>                         for (i=0; i<d->lp_len; i++) {
>                                 d->lowpassed[i] = 0;
>                         }
>                 } else {
>                         d->squelch_hits = 0;}
>         }
> 
> The signal enters the squelch after being low-pass filtered, then the
> RMS (basically, the power) is calculated and saved in ?sr?; if that is
> below the squelch threshold, the signal is zeroed out. If it's above,
> the signal passes to the next state. The squelch_hits just implement
> kind of a hysteresis.
> 
> So, yeah, a couple lines below:
> 
>     /* todo, fm noise squelch */
> 
> :) Soooo, maybe you'd want todo that?

	Thank you very much.
I feel a bit red-faced in that I could have stumbled on this as
it is right there as you describe, about 700 lines in. and the
source is good old C. I used gcc C for about 20 years at work so
this looks like old times for me.:-) That doesn't mean I
understand it all, but I will surely give it a try.

 I tend to try ridiculously simple ideas first
in hopes that one will work. In FM reception, the loudest noise
occurs when there is no signal or on occasion if there is a
nearby signal just outside the passband in which case the noise
squelch is closed more tightly. When one has the loudest noise,
there should be the largest variations in individual samples
compared to anything one will see when receiving a valid voice or
data signal that is within the passband. More reply to follow:

> CTCSS might be so low in frequency that their instantaneous amplitude
> might be sensed as energy or not, depending on how close they are to the
> LO (might get killed by the DC block).

	I did try receiving some signals which have no CTCSS or
DCS and sometimes, the transmission was clear but usually it flickered.

	I will first save some rtl_fm output to raw files and
then experiment with perl to see which ideas may have merit. When
something good happens, I will code the same logic in C.

 Am I correct in that the 16-bit samples are signed integers so
silence will look like 0x7fff or 0x8000 and extremes will be 0 or
0xffff?

	I would imagine that the noise squelch might also fall
short when receiving wide-band FM broadcasts as they contain
numerous sub carriers for stereo, RDS and auxiliary services.

	We will probably need both the noise and power squelches
as the noise squelch will probably be useless for AM and SSB. The
samples will probably not have enough of the right kind of noise
in them to do any good on anything but FM.

Martin WB5AGZ


More information about the osmocom-sdr mailing list