RTL-SDR IQ sample reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+25 -7
+18 -7
README.md
··· 11 11 12 12 ## Installation 13 13 14 + Install with opam: 15 + 16 + ```sh 17 + $ opam install rtlsdr 14 18 ``` 15 - opam install rtlsdr 19 + 20 + If opam cannot find the package, it may not yet be released in the public 21 + `opam-repository`. Add the overlay repository, then install it: 22 + 23 + ```sh 24 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 25 + $ opam update 26 + $ opam install rtlsdr 16 27 ``` 17 28 18 29 ## Usage 19 30 20 31 ```ocaml 21 32 (* Read IQ samples from a raw capture file *) 22 - let src = Rtlsdr.of_file "capture.raw" in 23 - Printf.printf "%d samples available\n" (Rtlsdr.sample_count src); 24 - let samples = Rtlsdr.read src 4096 in 25 - Rtlsdr.close src 33 + let src = Rtlsdr.of_file "capture.raw" 34 + let () = Printf.printf "%d samples available\n" (Rtlsdr.sample_count src) 35 + let samples = Rtlsdr.read src 4096 36 + let () = Rtlsdr.close src 26 37 27 38 (* Attach recording metadata *) 28 - let src = 39 + let meta = 29 40 Rtlsdr.of_file "capture.raw" 30 41 |> Rtlsdr.with_metadata 31 42 { center_freq = 137.5e6; sample_rate = 2.4e6; gain = 40.0 } 32 43 33 44 (* Generate a synthetic BPSK signal for testing *) 34 - let bits = Bytes.of_string "\x01\x00\x01\x01\x00" in 45 + let bits = Bytes.of_string "\x01\x00\x01\x01\x00" 35 46 let iq = 36 47 Rtlsdr.generate_bpsk 37 48 ~sample_rate:48000.0 ~symbol_rate:1200.0
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries rtlsdr))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name rtlsdr) 4 5 ··· 23 24 (ocaml (>= 5.0.0)) 24 25 dune 25 26 dsp 27 + (mdx :with-test) 26 28 (alcotest :with-test)))
+1
rtlsdr.opam
··· 14 14 "ocaml" {>= "5.0.0"} 15 15 "dune" {>= "3.21"} 16 16 "dsp" 17 + "mdx" {with-test} 17 18 "alcotest" {with-test} 18 19 "odoc" {with-doc} 19 20 ]