Class: PWN::SDR::Decoder::RTTY::Demod

Inherits:
Object
  • Object
show all
Defined in:
lib/pwn/sdr/decoder/rtty.rb

Overview

Streaming 2-FSK Baudot demodulator fed by Base.run_native.

Instance Method Summary collapse

Constructor Details

#initialize(rate: 48_000, baud: 45.45, mark_hz: 2125.0, space_hz: 2295.0) ⇒ Demod

Returns a new instance of Demod.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pwn/sdr/decoder/rtty.rb', line 16

def initialize(rate: 48_000, baud: 45.45, mark_hz: 2125.0, space_hz: 2295.0)
  @rate     = rate
  @baud     = baud
  @mark_hz  = mark_hz
  @space_hz = space_hz
  @spb      = rate / baud
  @buf      = []
  @figs     = false
  @line     = +''
  @idle_bits = 0
end

Instance Method Details

#feed(samples) ⇒ Object



28
29
30
31
32
33
# File 'lib/pwn/sdr/decoder/rtty.rb', line 28

def feed(samples, &)
  @buf.concat(samples)
  # keep at most ~2 s of audio buffered
  @buf.shift(@buf.length - (@rate * 2)) if @buf.length > @rate * 2
  demod_buffer(&)
end