From 2bcb62e7063dd8478d3e774a2d68064fabe60ea7 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 20 Jul 2021 00:57:43 +0200 Subject: [PATCH] add ssb chain --- csdr/__init__.py | 4 ++++ csdr/chain/ssb.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 csdr/chain/ssb.py diff --git a/csdr/__init__.py b/csdr/__init__.py index f3e8c41..4fdc83f 100644 --- a/csdr/__init__.py +++ b/csdr/__init__.py @@ -38,6 +38,7 @@ from csdr.pipe import Pipe from csdr.chain.demodulator import DemodulatorChain from csdr.chain.fm import Fm from csdr.chain.am import Am +from csdr.chain.ssb import Ssb import logging @@ -126,6 +127,9 @@ class Dsp(DirewolfConfigSubscriber): elif which == "am": self.pycsdr_chain = DemodulatorChain(self.samp_rate, self.get_audio_rate(), 0.0, Am()) return self.pycsdr_chain + elif which == "ssb": + self.pycsdr_chain = DemodulatorChain(self.samp_rate, self.get_audio_rate(), 0.0, Ssb()) + return self.pycsdr_chain chain = ["nc -v 127.0.0.1 {nc_port}"] chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"] diff --git a/csdr/chain/ssb.py b/csdr/chain/ssb.py new file mode 100644 index 0000000..e10ae96 --- /dev/null +++ b/csdr/chain/ssb.py @@ -0,0 +1,19 @@ +from csdr.chain import Chain +from csdr.chain.demodulator import Demodulator +from pycsdr.modules import RealPart, Agc, Convert +from pycsdr.types import Format + + +class Ssb(Demodulator): + def __init__(self): + workers = [ + RealPart(), + # empty chain as placeholder for the "last decimation" + Chain(), + Agc(Format.FLOAT), + Convert(Format.FLOAT, Format.SHORT), + ] + super().__init__(*workers) + + def setLastDecimation(self, decimation: Chain): + self.replace(1, decimation)