implement nxdn chain using new digiham components

This commit is contained in:
Jakob Ketterl 2021-07-31 00:10:10 +02:00
parent 1c91c6dcc1
commit f8f2740c77
2 changed files with 25 additions and 9 deletions

View File

@ -41,7 +41,7 @@ from csdr.chain.demodulator import DemodulatorChain
from csdr.chain.fm import NFm, WFm from csdr.chain.fm import NFm, WFm
from csdr.chain.am import Am from csdr.chain.am import Am
from csdr.chain.ssb import Ssb 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 from csdr.chain.clientaudio import ClientAudioChain
import logging import logging
@ -142,6 +142,9 @@ class Dsp(DirewolfConfigSubscriber):
elif which == "dstar": elif which == "dstar":
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dstar(self.codecserver)) self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dstar(self.codecserver))
return self.pycsdr_chain 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 = ["nc -v 127.0.0.1 {nc_port}"]
chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"] chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"]

View File

@ -1,31 +1,44 @@
from csdr.chain import Chain from csdr.chain import Chain
from pycsdr.modules import FmDemod from pycsdr.modules import FmDemod, Agc
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder 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): class Dstar(Chain):
def __init__(self, codecserver: str = ""): def __init__(self, codecserver: str = ""):
if codecserver is None:
codecserver = ""
agc = Agc(Format.SHORT)
agc.setMaxGain(30)
agc.setInitialGain(3)
workers = [ workers = [
FmDemod(), FmDemod(),
DcBlock(), DcBlock(),
FskDemodulator(samplesPerSymbol=10), FskDemodulator(samplesPerSymbol=10),
DstarDecoder(), DstarDecoder(),
MbeSynthesizer(codecserver), MbeSynthesizer(Modes.DStarMode, codecserver),
DigitalVoiceFilter() DigitalVoiceFilter(),
agc
] ]
super().__init__(*workers) super().__init__(*workers)
class Nxdn(Chain): class Nxdn(Chain):
def __init__(self, codecserver: str = ""): def __init__(self, codecserver: str = ""):
if codecserver is None:
codecserver = ""
agc = Agc(Format.SHORT)
agc.setMaxGain(30)
agc.setInitialGain(3)
workers = [ workers = [
FmDemod(), FmDemod(),
DcBlock(), DcBlock(),
NarrowRrcFilter(), NarrowRrcFilter(),
# todo: switch out with gfsk GfskDemodulator(samplesPerSymbol=20),
FskDemodulator(samplesPerSymbol=20),
NxdnDecoder(), NxdnDecoder(),
MbeSynthesizer(codecserver), MbeSynthesizer(Modes.NxdnMode, codecserver),
DigitalVoiceFilter() DigitalVoiceFilter(),
agc,
] ]
super().__init__(*workers) super().__init__(*workers)