get freedv back by modeling a corresponding module and chain

This commit is contained in:
Jakob Ketterl 2021-09-13 16:58:02 +02:00
parent 1c937e147e
commit e5b120311d
3 changed files with 44 additions and 0 deletions

28
csdr/chain/freedv.py Normal file
View File

@ -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

View File

@ -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)

13
owrx/freedv.py Normal file
View File

@ -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", "-", "-"]