add ssb chain

This commit is contained in:
Jakob Ketterl 2021-07-20 00:57:43 +02:00
parent be093b8b05
commit 2bcb62e706
2 changed files with 23 additions and 0 deletions

View File

@ -38,6 +38,7 @@ from csdr.pipe import Pipe
from csdr.chain.demodulator import DemodulatorChain from csdr.chain.demodulator import DemodulatorChain
from csdr.chain.fm import Fm from csdr.chain.fm import Fm
from csdr.chain.am import Am from csdr.chain.am import Am
from csdr.chain.ssb import Ssb
import logging import logging
@ -126,6 +127,9 @@ class Dsp(DirewolfConfigSubscriber):
elif which == "am": elif which == "am":
self.pycsdr_chain = DemodulatorChain(self.samp_rate, self.get_audio_rate(), 0.0, Am()) self.pycsdr_chain = DemodulatorChain(self.samp_rate, self.get_audio_rate(), 0.0, Am())
return self.pycsdr_chain 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 = ["nc -v 127.0.0.1 {nc_port}"]
chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"] chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"]

19
csdr/chain/ssb.py Normal file
View File

@ -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)