-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRXplot.py
executable file
·50 lines (39 loc) · 1.23 KB
/
RXplot.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
"""
Wideband FM demodulation and plotting of baseband multiplex spectrum
Michael Hirsch, Ph.D.
Especially useful for spectrum saved from RTL-SDR with GNU Radio, GQRX, etc.
"""
from pathlib import Path
from matplotlib.pyplot import show
from radioutils import loadbin, fm_demod, playaudio
from argparse import ArgumentParser
import seaborn
seaborn.set_context("talk")
fsaudio = 48000 # [Hz], sampling rate of your soundcard for playback
def main():
p = ArgumentParser()
p.add_argument("fn", help="binary raw IQ capture SDR file to analyze")
p.add_argument("fs", help="sampling frequency [Hz]", type=int)
p.add_argument("-fc", help="baseband tunding freq [Hz]", type=float)
p.add_argument(
"-t",
"--tlim",
help="start stop increment [seconds] to load",
type=float,
nargs=2,
default=(0.0, None),
)
p.add_argument("-v", "--verbose", action="store_true")
P = p.parse_args()
fn = Path(P.fn).expanduser()
assert isinstance(P.fs, (float, int))
fs = int(P.fs)
# %%
sig = loadbin(fn, fs, P.tlim)
# %%
m = fm_demod(sig, fs, fsaudio, P.fc, 75e3, P.verbose)
playaudio(m, fsaudio)
show()
if __name__ == "__main__":
main()