openwebrx-clone/csdr/chain/fm.py

24 lines
724 B
Python
Raw Normal View History

2021-07-19 17:04:14 +00:00
from csdr.chain.demodulator import Demodulator, Chain
from pycsdr.modules import FmDemod, Limit, NfmDeemphasis, Agc, Convert
2021-07-20 15:58:32 +00:00
from pycsdr.types import Format, AgcProfile
2021-07-19 17:04:14 +00:00
class Fm(Demodulator):
def __init__(self, sampleRate: int):
2021-07-20 15:58:32 +00:00
agc = Agc(Format.FLOAT)
agc.setProfile(AgcProfile.SLOW)
agc.setMaxGain(3)
2021-07-19 17:04:14 +00:00
workers = [
FmDemod(),
Limit(),
# empty chain as placeholder for the "last decimation"
Chain(),
NfmDeemphasis(sampleRate),
2021-07-20 15:58:32 +00:00
agc,
2021-07-19 17:04:14 +00:00
Convert(Format.FLOAT, Format.SHORT),
]
super().__init__(*workers)
def setLastDecimation(self, decimation: Chain):
self.replace(2, decimation)