2021-07-24 20:25:41 +00:00
|
|
|
from csdr.chain import Chain
|
2021-07-25 20:44:53 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
2021-07-25 20:44:53 +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)
|
2021-07-25 20:44:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
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)
|