Module: PWN::SDR::Decoder::Morse

Defined in:
lib/pwn/sdr/decoder/morse.rb

Overview

Pure-Ruby CW / Morse decoder for the amateur CW sub-bands.

GQRX's CW/USB demodulator produces a ~600–800 Hz sidetone in the 48 kHz UDP audio stream. This module envelope-detects the tone with a state-preserving single-pole low-pass, adaptively thresholds it into on/off runs, classifies each run as dit / dah / char-gap / word-gap by timing, and looks the resulting .- sequences up in DSP::MORSE_TABLE. No multimon-ng, no sox.

Defined Under Namespace

Classes: Demod

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. support@0dayinc.com



118
119
120
# File 'lib/pwn/sdr/decoder/morse.rb', line 118

public_class_method def self.authors
  "AUTHOR(S):\n  0day Inc. <support@0dayinc.com>\n"
end

.decode(opts = {}) ⇒ Object

Supported Method Parameters

PWN::SDR::Decoder::Morse.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' )



98
99
100
101
102
103
104
105
# File 'lib/pwn/sdr/decoder/morse.rb', line 98

public_class_method def self.decode(opts = {})
  freq_obj = opts[:freq_obj]
  PWN::SDR::Decoder::Base.run_native(
    freq_obj: freq_obj,
    protocol: 'MORSE-CW',
    demod: Demod.new
  )
end

.decode_string(opts = {}) ⇒ Object

Supported Method Parameters

h = PWN::SDR::Decoder::Morse.decode_string(pattern: '.- -...')



110
111
112
113
114
# File 'lib/pwn/sdr/decoder/morse.rb', line 110

public_class_method def self.decode_string(opts = {})
  pattern = opts[:pattern].to_s
  txt = pattern.strip.split(/\s+/).map { |s| PWN::SDR::Decoder::DSP::MORSE_TABLE[s] || '_' }.join
  { protocol: 'MORSE-CW', text: txt, summary: "CW #{txt}" }
end

.helpObject

Display Usage for this Module



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/pwn/sdr/decoder/morse.rb', line 124

public_class_method def self.help
  puts "USAGE (ruby-native, no external binaries):
    #{self}.decode(
      freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq'
    )

    #{self}.decode_string(pattern: '.- -...')

    #{self}.authors
  "
end