Rowan-Classes/7th-Semester-Fall-2024/ECOMMS/final-project/sdr_stream.py
2025-01-15 17:59:04 -05:00

32 lines
714 B
Python

#from rtlsdr.rtlsdrtcp.client import RtlSdrTcpClient
import asyncio
from rtlsdr import RtlSdr
from bfm_demod import BfmDemod
from gfsk_demod import GFSKDemod
import sounddevice as sd
import numpy as np
def main():
#sdr = RtlSdrTcpClient(hostname='localhost', port=12345)
sdr = RtlSdr()
sdr.set_sample_rate(2.048E6)
sdr.set_center_freq(434.55E6)
sdr.set_freq_correction(60)
sdr.set_gain("auto")
stream = sd.OutputStream(samplerate=48E3, dtype=np.float32, channels=1)
sink = GFSKDemod(sdr=sdr)
#sink = BfmDemod(sdr=sdr, stream=stream)
loop = asyncio.get_event_loop()
loop.run_until_complete(sink.start())
sdr.close()
if __name__ == "__main__":
main()