Τρίτη 3 Σεπτεμβρίου 2024

TCI Morse code decoder for SUNSDR

Morse Code Decoding Pipeline with SUNSDR, SOX, and Multimon-NG

This command line one-liner demonstrates how to receive, process, and decode Morse code signals using a combination of Python, SOX, and Multimon-NG. Below is a breakdown of the process and the software tools involved:

1. SUNSDR Transceiver and eesdr-tci Python Library

  • SUNSDR Transceiver: The SUNSDR transceiver is a software-defined radio (SDR) device that allows users to transmit and receive radio signals. It can handle a wide range of frequencies and modulations.
  • eesdr-tci: The eesdr-tci library is a Python interface for controlling Expert Electronics SDRs, like the SUNSDR, via the TCI (Transceiver Control Interface) protocol. This library allows interaction with the SDR, managing its settings, and receiving audio samples directly into a Python script.

The command used to receive audio samples is:

python3 ~/eesdr-tci/example/receive_audio.py

This command runs a Python script that connects to the SUNSDR transceiver and receives raw audio samples, typically in a high-fidelity format suitable for further processing.

2. SOX (Sound eXchange)

  • SOX: SOX is a versatile command-line utility that can convert and manipulate audio data in various formats. It's widely used for resampling, converting between audio formats, and applying effects.
  • Resampling with SOX: In this one-liner, SOX is used to resample the audio from the SUNSDR. The original audio is in a 48 kHz sample rate with 16-bit signed integer format and stereo channels. This audio is downsampled to a 22.05 kHz sample rate with mono channel output, which is more suitable for processing by the Morse code decoder.

The SOX command is:

sox -V -t raw -b 16 -e signed-integer -c 2 -r 48k - -t raw -b 16 -e signed-integer -c 1 -r 22050 -

Here’s what the options mean:

  • -V: Enables verbosity, allowing you to see what SOX is doing.
  • -t raw: Specifies that the input and output are raw audio streams.
  • -b 16 -e signed-integer: Specifies 16-bit signed integer encoding.
  • -c 2 -r 48k: Indicates that the input audio has 2 channels and a sample rate of 48 kHz.
  • -c 1 -r 22050: Specifies that the output should have 1 channel (mono) and a sample rate of 22.05 kHz.

3. Multimon-NG

  • Multimon-NG: This is a popular multi-channel decoder for various digital transmission formats, including Morse code (CW), POCSAG, FLEX, and others. Multimon-NG takes the resampled audio and decodes the Morse code signals into readable text.

The Multimon-NG command is:

multimon-ng -c -a MORSE_CW -

Here’s what the options mean:

  • -c: removes all other demodulators except for what is specified with -a.
  • -a MORSE_CW: Tells Multimon-NG to use the Morse code (CW) decoder.
  • -: Specifies that the input will be taken from the standard input (piped from the SOX command).

Summary

This one-liner integrates multiple tools to achieve a seamless workflow for decoding Morse code. The Python script communicates with the SUNSDR transceiver to receive raw audio samples, which are then resampled by SOX to a suitable format for Morse code decoding. Finally, Multimon-NG decodes the resampled audio and extracts the Morse code, outputting the decoded text to the console. This pipeline is efficient for real-time signal processing and decoding in a streamlined manner.

  • python3 ~/eesdr-tci/example/receive_audio.py |sox -V -t raw -b 16 -e signed-integer -c 2 -r 48k - -t raw -b 16 -e signed-integer -c 1 -r 22050 - | multimon-ng -c -a MORSE_CW -