Skip to content

Add squelch tool#26

Open
W3AXL wants to merge 6 commits intopvachon:masterfrom
W3AXL:add-csq
Open

Add squelch tool#26
W3AXL wants to merge 6 commits intopvachon:masterfrom
W3AXL:add-csq

Conversation

@W3AXL
Copy link
Copy Markdown

@W3AXL W3AXL commented Sep 20, 2022

added a squelch tool to the library, which functions similar to the resampler tool (and in fact the basic code structure was shamelessly stolen from it)

The squelch algorithm is very similar to what KA7OEI describes: my implementation detects noise above 4khz using an FIR HPF and calculates the energy of the isolated signal. This is then averaged and scaled to be within a ~1-12 integer range. Output audio is unmuted based on comparison of this calculated energy and the inverse of the set squelch level.

Features:

  • Takes in a fifo of demodulated audio samples (from multifm or similar)
  • Can output to another fifo or to stdout for piping into tools like ffmpeg
  • Configurable silence modes - silence (continuous 0-valued samples) or truncation (no output until unsquelched)
  • Supports sample rates of 12k, 16k, 20k, and 24k (limited by pre-defined FIR filters for HPF)
  • Variable squelch level from 0 (open squelch) to 10 (tight)
  • All calculations are fixed-point integers to save on processing power as much as possible
  • All FIR filters used for noise isolation are <100 taps.

Example usage, reading FM demod samples from infifo and saving the squelched audio to a wav file using ffmpeg:

$ squelch -S 12000 -L 7 ./infifo | ffmpeg -f s16le -ar 12000 -ac 1 -i pipe:0 squelch_test.wav

The -h flag gives additional usage parameters.

Future expansion could include CTCSS tone detection using the Goetzel algorithm, and probably DCS as well without too much fuss.

added an optional parameter to the config json file

per channel, you can specify a "csqLeveldBFS" parameter which is the squelch threshold in dBFS (the same unit SDR sharp uses). A value of 0, or the parameter missing entirely, will result in open squelch.
should hopefully reduce the CPU usage a bit
@W3AXL W3AXL mentioned this pull request Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant