add YSF chain; re-introduce RRC filters

This commit is contained in:
Jakob Ketterl 2021-08-10 14:03:49 +02:00
parent 2b3123c7cb
commit 1e8527da68
2 changed files with 47 additions and 23 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, Nxdn, Dmr from csdr.chain.digiham import Dstar, Nxdn, Dmr, Ysf
from csdr.chain.clientaudio import ClientAudioChain from csdr.chain.clientaudio import ClientAudioChain
import logging import logging
@ -149,6 +149,9 @@ class Dsp(DirewolfConfigSubscriber):
elif which == "dmr": elif which == "dmr":
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dmr(self.codecserver)) self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dmr(self.codecserver))
return self.pycsdr_chain return self.pycsdr_chain
elif which == "ysf":
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Ysf(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,23 +1,25 @@
from csdr.chain import Chain from csdr.chain import Chain
from pycsdr.modules import FmDemod, Agc, Writer from pycsdr.modules import FmDemod, Agc, Writer
from pycsdr.types import Format from pycsdr.types import Format
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder, DmrDecoder from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder, DmrDecoder, WideRrcFilter, YsfDecoder
from digiham.ambe import Modes from digiham.ambe import Modes
class DigihamChain(Chain): class DigihamChain(Chain):
def __init__(self, codecserver: str = ""): def __init__(self, fskDemodulator, decoder, mbeMode, filter=None, codecserver: str = ""):
self.decoder = decoder
if codecserver is None: if codecserver is None:
codecserver = "" codecserver = ""
agc = Agc(Format.SHORT) agc = Agc(Format.SHORT)
agc.setMaxGain(30) agc.setMaxGain(30)
agc.setInitialGain(3) agc.setInitialGain(3)
workers = [ workers = [FmDemod(), DcBlock()]
FmDemod(), if filter is not None:
DcBlock(), workers += [filter]
self.fskDemodulator, workers += [
self.decoder, fskDemodulator,
MbeSynthesizer(self.mbeMode, codecserver), decoder,
MbeSynthesizer(mbeMode, codecserver),
DigitalVoiceFilter(), DigitalVoiceFilter(),
agc agc
] ]
@ -29,26 +31,45 @@ class DigihamChain(Chain):
class Dstar(DigihamChain): class Dstar(DigihamChain):
def __init__(self, codecserver: str = ""): def __init__(self, codecserver: str = ""):
self.fskDemodulator = FskDemodulator(samplesPerSymbol=10) super().__init__(
self.decoder = DstarDecoder() fskDemodulator=FskDemodulator(samplesPerSymbol=10),
self.mbeMode = Modes.DStarMode decoder=DstarDecoder(),
super().__init__(codecserver) mbeMode=Modes.DStarMode,
codecserver=codecserver
)
class Nxdn(DigihamChain): class Nxdn(DigihamChain):
def __init__(self, codecserver: str = ""): def __init__(self, codecserver: str = ""):
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=20) super().__init__(
self.decoder = NxdnDecoder() fskDemodulator=GfskDemodulator(samplesPerSymbol=20),
self.mbeMode = Modes.NxdnMode decoder=NxdnDecoder(),
super().__init__(codecserver) mbeMode=Modes.NxdnMode,
filter=NarrowRrcFilter(),
codecserver=codecserver
)
class Dmr(DigihamChain): class Dmr(DigihamChain):
def __init__(self, codecserver: str = ""): def __init__(self, codecserver: str = ""):
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=10) super().__init__(
self.decoder = DmrDecoder() fskDemodulator=GfskDemodulator(samplesPerSymbol=10),
self.mbeMode = Modes.DmrMode decoder=DmrDecoder(),
super().__init__(codecserver) mbeMode=Modes.DmrMode,
filter=WideRrcFilter(),
codecserver=codecserver,
)
def setSlotFilter(self, filter: int) -> None: def setSlotFilter(self, slotFilter: int) -> None:
self.decoder.setSlotFilter(filter) self.decoder.setSlotFilter(slotFilter)
class Ysf(DigihamChain):
def __init__(self, codecserver: str = ""):
super().__init__(
fskDemodulator=GfskDemodulator(samplesPerSymbol=10),
decoder=YsfDecoder(),
mbeMode=Modes.YsfMode,
filter=WideRrcFilter(),
codecserver=codecserver
)