@jtarrio/webrtlsdr 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -32,6 +32,8 @@ I want to write a comprehensive set of documentation, but in the meantime, here
32
32
 
33
33
  ### High-level access to RTL-SDR (demodulate and play through the computer's speakers)
34
34
 
35
+ This program is a complete stereo FM radio receiver tuned for 88.5 MHz.
36
+
35
37
  ```typescript
36
38
  import { Demodulator } from "@jtarrio/webrtlsdr/demod/demodulator";
37
39
  import { getMode } from "@jtarrio/webrtlsdr/demod/scheme";
@@ -40,18 +42,26 @@ import { RTL2832U_Provider } from "@jtarrio/webrtlsdr/rtlsdr/rtl2832u";
40
42
 
41
43
  const sampleRate = 1024000;
42
44
  let demodulator = new Demodulator(sampleRate);
43
- let radio = new Radio(new RTL2832U_Provider(), spectrum, sampleRate);
45
+ let radio = new Radio(new RTL2832U_Provider(), demodulator, sampleRate);
44
46
 
45
47
  radio.setFrequency(88500000);
46
48
  demodulator.setVolume(1);
47
49
  demodulator.setMode(getMode("WBFM"));
48
50
 
49
- getElementById("playButton").addEventListener("click", () => radio.start());
50
- getElementById("stopButton").addEventListener("click", () => radio.stop());
51
+ document
52
+ .getElementById("playButton")
53
+ .addEventListener("click", () => radio.start());
54
+ document
55
+ .getElementById("stopButton")
56
+ .addEventListener("click", () => radio.stop());
51
57
  ```
52
58
 
59
+ You can also see a full example at [`examples/highlevel`](examples/highlevel/script.js).
60
+
53
61
  ### Low-level access (read samples straight from the stick)
54
62
 
63
+ This program connects to the RTL-SDR stick, tunes to 88.5 MHz, reads 65536 samples, and closes the connection.
64
+
55
65
  ```typescript
56
66
  let provider = new RTL2832U_Provider();
57
67
  let device = await provider.get();
@@ -60,10 +70,13 @@ await device.setCenterFrequency(88500000);
60
70
  await device.setGain(null);
61
71
  await device.resetBuffer();
62
72
  let samples = await device.readSamples(65536);
73
+ await device.close();
63
74
  ```
64
75
 
76
+ You can also see a full example at [`examples/lowlevel`](examples/lowlevel/script.js).
77
+
65
78
  ## Acknowledgements
66
79
 
67
- This is a spinoff of https://github.com/jtarrio/radioreceiver, which is, in turn, a fork of https://github.com/google/radioreceiver. I am the original author, but I was employed by Google at the time.
80
+ This is a spinoff of https://github.com/jtarrio/radioreceiver, which is, in turn, a fork of https://github.com/google/radioreceiver. (I am the original author, but I was employed by Google at the time.)
68
81
 
69
82
  Kudos and thanks to the [RTL-SDR project](http://sdr.osmocom.org/trac/wiki/rtl-sdr) for figuring out the magic numbers needed to drive the USB tuner.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jtarrio/webrtlsdr",
3
3
  "description": "Access RTL-SDR devices and receive and demodulate radio signals from your web application",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "author": "Jacobo Tarrio <jtarrio@gmail.com>",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {