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
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.decode(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::SDR::Decoder::Morse.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ).
-
.decode_string(opts = {}) ⇒ Object
- Supported Method Parameters
h = PWN::SDR::Decoder::Morse.decode_string(pattern: '.- -...').
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. support@0dayinc.com
135 136 137 |
# File 'lib/pwn/sdr/decoder/morse.rb', line 135 public_class_method def self. "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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/pwn/sdr/decoder/morse.rb', line 98 public_class_method def self.decode(opts = {}) freq_obj = opts[:freq_obj] # Prefer true-air I/Q (FM-demod → existing audio demod) when the # operator asks for a source/file or sets freq_obj[:iq_source]. # Otherwise keep the GQRX 48 kHz UDP audio path (run_native). want_iq = opts[:source] || opts[:file] || freq_obj[:iq_source] || freq_obj[:iq_file] if want_iq PWN::SDR::Decoder::Base.run_iq( freq_obj: freq_obj, protocol: 'MORSE-CW', demod: Demod.new, sample_rate: (opts[:sample_rate] || freq_obj[:iq_rate] || 48_000).to_i, source: opts[:source], file: opts[:file], fm_demod: true, note: 'MORSE-CW true-air: FM-demod I/Q then native bit recovery; falls back to detector without SDR hardware.' ) else PWN::SDR::Decoder::Base.run_native( freq_obj: freq_obj, protocol: 'MORSE-CW', demod: Demod.new ) end end |
.decode_string(opts = {}) ⇒ Object
- Supported Method Parameters
h = PWN::SDR::Decoder::Morse.decode_string(pattern: '.- -...')
127 128 129 130 131 |
# File 'lib/pwn/sdr/decoder/morse.rb', line 127 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 |
.help ⇒ Object
Display Usage for this Module
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/pwn/sdr/decoder/morse.rb', line 141 public_class_method def self.help puts "USAGE (true-air I/Q + GQRX-audio native paths, no external binaries): #{self}.decode( freq_obj: 'required - freq_obj returned from PWN::SDR::GQRX.init_freq' ) #{self}.decode_string(pattern: '.- -...') #{self}.authors " end |