summaryrefslogtreecommitdiff
path: root/fm.py
blob: dc8df68eb93ae1978d97b431a36e5eb2b6591244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import asyncio
from rtlsdr import RtlSdr

RATE_IN = RATE_OUT = 170000
RATE_OUT2 = 32000
CUSTOM_ATAN = 1
DEEMPH = 1
SQUELCH = 0

async def streaming():
    sdr = RtlSdr()

    async for samples in sdr.stream():
        # do something with samples
        # ...
        print(len(samples), samples[0])

    # to stop streaming:
    await sdr.stop()

    # done
    sdr.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(streaming())