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.am import Am
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
import logging
@ -149,6 +149,9 @@ class Dsp(DirewolfConfigSubscriber):
elif which == "dmr":
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dmr(self.codecserver))
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 += ["csdr shift_addfast_cc --fifo {shift_pipe}"]

View File

@ -1,23 +1,25 @@
from csdr.chain import Chain
from pycsdr.modules import FmDemod, Agc, Writer
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
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:
codecserver = ""
agc = Agc(Format.SHORT)
agc.setMaxGain(30)
agc.setInitialGain(3)
workers = [
FmDemod(),
DcBlock(),
self.fskDemodulator,
self.decoder,
MbeSynthesizer(self.mbeMode, codecserver),
workers = [FmDemod(), DcBlock()]
if filter is not None:
workers += [filter]
workers += [
fskDemodulator,
decoder,
MbeSynthesizer(mbeMode, codecserver),
DigitalVoiceFilter(),
agc
]
@ -29,26 +31,45 @@ class DigihamChain(Chain):
class Dstar(DigihamChain):
def __init__(self, codecserver: str = ""):
self.fskDemodulator = FskDemodulator(samplesPerSymbol=10)
self.decoder = DstarDecoder()
self.mbeMode = Modes.DStarMode
super().__init__(codecserver)
super().__init__(
fskDemodulator=FskDemodulator(samplesPerSymbol=10),
decoder=DstarDecoder(),
mbeMode=Modes.DStarMode,
codecserver=codecserver
)
class Nxdn(DigihamChain):
def __init__(self, codecserver: str = ""):
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=20)
self.decoder = NxdnDecoder()
self.mbeMode = Modes.NxdnMode
super().__init__(codecserver)
super().__init__(
fskDemodulator=GfskDemodulator(samplesPerSymbol=20),
decoder=NxdnDecoder(),
mbeMode=Modes.NxdnMode,
filter=NarrowRrcFilter(),
codecserver=codecserver
)
class Dmr(DigihamChain):
def __init__(self, codecserver: str = ""):
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=10)
self.decoder = DmrDecoder()
self.mbeMode = Modes.DmrMode
super().__init__(codecserver)
super().__init__(
fskDemodulator=GfskDemodulator(samplesPerSymbol=10),
decoder=DmrDecoder(),
mbeMode=Modes.DmrMode,
filter=WideRrcFilter(),
codecserver=codecserver,
)
def setSlotFilter(self, filter: int) -> None:
self.decoder.setSlotFilter(filter)
def setSlotFilter(self, slotFilter: int) -> None:
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
)