diff --git a/csdr/chain/freedv.py b/csdr/chain/freedv.py new file mode 100644 index 0000000..d3f2730 --- /dev/null +++ b/csdr/chain/freedv.py @@ -0,0 +1,28 @@ +from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain +from owrx.freedv import FreeDVModule +from pycsdr.modules import RealPart, Agc, Convert +from pycsdr.types import Format + + +class FreeDV(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain): + def __init__(self): + agc = Agc(Format.SHORT) + agc.setMaxGain(30) + agc.setInitialGain(3) + workers = [ + RealPart(), + Agc(Format.FLOAT), + Convert(Format.FLOAT, Format.SHORT), + FreeDVModule(), + agc, + ] + super().__init__(workers) + + def getFixedIfSampleRate(self) -> int: + return 8000 + + def getFixedAudioRate(self) -> int: + return 8000 + + def supportsSquelch(self) -> bool: + return False diff --git a/owrx/dsp.py b/owrx/dsp.py index 1b5856f..af4ccd7 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -12,6 +12,7 @@ from csdr.chain.clientaudio import ClientAudioChain from csdr.chain.analog import NFm, WFm, Am, Ssb from csdr.chain.digiham import DigihamChain, Dmr, Dstar, Nxdn, Ysf from csdr.chain.m17 import M17Chain +from csdr.chain.freedv import FreeDV from csdr.chain.drm import Drm from csdr.chain.fft import FftChain from csdr.chain.digimodes import AudioChopperDemodulator, PacketDemodulator, PocsagDemodulator @@ -452,6 +453,8 @@ class DspManager(Output, SdrSourceEventClient): return M17Chain() elif demod == "drm": return Drm() + elif demod == "freedv": + return FreeDV() def setDemodulator(self, mod): demodulator = self._getDemodulator(mod) diff --git a/owrx/freedv.py b/owrx/freedv.py new file mode 100644 index 0000000..2c1014f --- /dev/null +++ b/owrx/freedv.py @@ -0,0 +1,13 @@ +from pycsdr.types import Format +from csdr.module import PopenModule + + +class FreeDVModule(PopenModule): + def getInputFormat(self) -> Format: + return Format.SHORT + + def getOutputFormat(self) -> Format: + return Format.SHORT + + def getCommand(self): + return ["freedv_rx", "1600", "-", "-"]