Class: Radio::PSK31::Rx

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/radio/psk31/rx.rb

Constant Summary collapse

FIR_BIT =

16 Hz bw LP filter for data recovery

FirPM.new numtaps: 65, type: :bandpass,
bands: [0.0,0.03125,0.0625,0.5], desired: [1,1,0,0], weights: [1,286]

Constants included from Utils

Utils::FIRPM_CACHE_FILENAME, Utils::FIRPM_CACHE_VERSION

Instance Method Summary collapse

Methods included from Utils

firpm, hamming_window, hamming_window!, kaiser_estimate

Constructor Details

#initialize(frequency) ⇒ Rx

Returns a new instance of Rx.



28
29
30
31
32
33
34
35
36
# File 'lib/radio/psk31/rx.rb', line 28

def initialize frequency
  mix = frequency.to_f / 8000
  fir_500hz = firpm numtaps: 35, type: :bandpass,
    bands: [0,0.0125,0.125,0.5], desired: [1,1,0,0], weights: [1,10]
  @dec_filter = Filter.new mix:mix, decimate:16, fir:fir_500hz
  @bit_filter = Filter.new fir:FIR_BIT
  @bit_detect = BitDetect.new
  @decoder = Decoder.new
end

Instance Method Details

#call(data) {|decoded| ... } ⇒ Object

Yields:

  • (decoded)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/radio/psk31/rx.rb', line 38

def call data
  decoded = ''
  @dec_filter.call data do |data|
    @bit_filter.call data do |data|
      data.each do |iq|
        @bit_detect.call iq do |iq|
          @decoder.call iq do |symbol|
            decoded += symbol
          end
        end
      end
    end
  end
  yield decoded
end