diff --git a/csdr/__init__.py b/csdr/__init__.py index 3e13453..1677fb8 100644 --- a/csdr/__init__.py +++ b/csdr/__init__.py @@ -41,7 +41,7 @@ from csdr.chain.demodulator import DemodulatorChain from csdr.chain.fm import NFm, WFm from csdr.chain.am import Am from csdr.chain.ssb import Ssb -from csdr.chain.digiham import Dstar +from csdr.chain.digiham import Dstar, Nxdn from csdr.chain.clientaudio import ClientAudioChain import logging @@ -142,6 +142,9 @@ class Dsp(DirewolfConfigSubscriber): elif which == "dstar": self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dstar(self.codecserver)) return self.pycsdr_chain + elif which == "nxdn": + self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Nxdn(self.codecserver)) + 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/digiham.py b/csdr/chain/digiham.py index c3c8a9b..110d8a5 100644 --- a/csdr/chain/digiham.py +++ b/csdr/chain/digiham.py @@ -1,31 +1,44 @@ from csdr.chain import Chain -from pycsdr.modules import FmDemod -from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder +from pycsdr.modules import FmDemod, Agc +from pycsdr.types import Format +from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder +from digiham.ambe import Modes class Dstar(Chain): def __init__(self, codecserver: str = ""): + if codecserver is None: + codecserver = "" + agc = Agc(Format.SHORT) + agc.setMaxGain(30) + agc.setInitialGain(3) workers = [ FmDemod(), DcBlock(), FskDemodulator(samplesPerSymbol=10), DstarDecoder(), - MbeSynthesizer(codecserver), - DigitalVoiceFilter() + MbeSynthesizer(Modes.DStarMode, codecserver), + DigitalVoiceFilter(), + agc ] super().__init__(*workers) class Nxdn(Chain): def __init__(self, codecserver: str = ""): + if codecserver is None: + codecserver = "" + agc = Agc(Format.SHORT) + agc.setMaxGain(30) + agc.setInitialGain(3) workers = [ FmDemod(), DcBlock(), NarrowRrcFilter(), - # todo: switch out with gfsk - FskDemodulator(samplesPerSymbol=20), + GfskDemodulator(samplesPerSymbol=20), NxdnDecoder(), - MbeSynthesizer(codecserver), - DigitalVoiceFilter() + MbeSynthesizer(Modes.NxdnMode, codecserver), + DigitalVoiceFilter(), + agc, ] super().__init__(*workers)