start building digiham chains
This commit is contained in:
parent
11a3606070
commit
1c91c6dcc1
@ -41,6 +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.clientaudio import ClientAudioChain
|
||||
|
||||
import logging
|
||||
@ -138,6 +139,9 @@ class Dsp(DirewolfConfigSubscriber):
|
||||
elif which == "wfm":
|
||||
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 200000, 0.0, WFm(self.get_audio_rate(), self.wfm_deemphasis_tau))
|
||||
return self.pycsdr_chain
|
||||
elif which == "dstar":
|
||||
self.pycsdr_chain = DemodulatorChain(self.samp_rate, 48000, 0.0, Dstar(self.codecserver))
|
||||
return self.pycsdr_chain
|
||||
|
||||
chain = ["nc -v 127.0.0.1 {nc_port}"]
|
||||
chain += ["csdr shift_addfast_cc --fifo {shift_pipe}"]
|
||||
@ -741,7 +745,8 @@ class Dsp(DirewolfConfigSubscriber):
|
||||
chain.setInput(self.buffer)
|
||||
|
||||
output_rate = self.get_hd_output_rate() if self.isHdAudio() else self.get_output_rate()
|
||||
self.pycsdr_client_chain = ClientAudioChain(self.get_audio_rate(), output_rate, self.audio_compression)
|
||||
audio_rate = 8000 if self.isDigitalVoice() else self.get_audio_rate()
|
||||
self.pycsdr_client_chain = ClientAudioChain(chain.getOutputFormat(), audio_rate, output_rate, self.audio_compression)
|
||||
buffer = Buffer(chain.getOutputFormat())
|
||||
chain.setWriter(buffer)
|
||||
self.pycsdr_client_chain.setInput(buffer)
|
||||
|
@ -4,8 +4,10 @@ from pycsdr.types import Format
|
||||
|
||||
|
||||
class ClientAudioChain(Chain):
|
||||
def __init__(self, inputRate: int, clientRate: int, compression: str):
|
||||
def __init__(self, format: Format, inputRate: int, clientRate: int, compression: str):
|
||||
workers = []
|
||||
if format != Format.FLOAT:
|
||||
workers += [Convert(format, Format.FLOAT)]
|
||||
if inputRate != clientRate:
|
||||
workers += [AudioResampler(inputRate, clientRate)]
|
||||
workers += [Convert(Format.FLOAT, Format.SHORT)]
|
||||
|
31
csdr/chain/digiham.py
Normal file
31
csdr/chain/digiham.py
Normal file
@ -0,0 +1,31 @@
|
||||
from csdr.chain import Chain
|
||||
from pycsdr.modules import FmDemod
|
||||
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder
|
||||
|
||||
|
||||
class Dstar(Chain):
|
||||
def __init__(self, codecserver: str = ""):
|
||||
workers = [
|
||||
FmDemod(),
|
||||
DcBlock(),
|
||||
FskDemodulator(samplesPerSymbol=10),
|
||||
DstarDecoder(),
|
||||
MbeSynthesizer(codecserver),
|
||||
DigitalVoiceFilter()
|
||||
]
|
||||
super().__init__(*workers)
|
||||
|
||||
|
||||
class Nxdn(Chain):
|
||||
def __init__(self, codecserver: str = ""):
|
||||
workers = [
|
||||
FmDemod(),
|
||||
DcBlock(),
|
||||
NarrowRrcFilter(),
|
||||
# todo: switch out with gfsk
|
||||
FskDemodulator(samplesPerSymbol=20),
|
||||
NxdnDecoder(),
|
||||
MbeSynthesizer(codecserver),
|
||||
DigitalVoiceFilter()
|
||||
]
|
||||
super().__init__(*workers)
|
Loading…
Reference in New Issue
Block a user