openwebrx-clone/csdr/chain/fm.py

29 lines
807 B
Python
Raw Normal View History

from csdr.chain import Chain
from pycsdr.modules import FmDemod, Limit, NfmDeemphasis, Agc, WfmDeemphasis, FractionalDecimator
2021-07-20 15:58:32 +00:00
from pycsdr.types import Format, AgcProfile
2021-07-19 17:04:14 +00:00
class NFm(Chain):
2021-07-19 17:04:14 +00:00
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(),
NfmDeemphasis(sampleRate),
2021-07-20 15:58:32 +00:00
agc,
2021-07-19 17:04:14 +00:00
]
super().__init__(*workers)
class WFm(Chain):
def __init__(self, sampleRate: int, tau: float):
workers = [
FmDemod(),
Limit(),
FractionalDecimator(Format.FLOAT, 200000.0 / sampleRate, prefilter=True),
WfmDeemphasis(sampleRate, tau),
]
super().__init__(*workers)