@jtarrio/webrtlsdr 2.0.5 → 3.0.1

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 (110) hide show
  1. package/README.md +5 -6
  2. package/dist/errors.d.ts +1 -2
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +0 -1
  5. package/dist/errors.js.map +1 -1
  6. package/dist/radio/radio.d.ts +22 -63
  7. package/dist/radio/radio.d.ts.map +1 -1
  8. package/dist/radio/radio.js +41 -255
  9. package/dist/radio/radio.js.map +1 -1
  10. package/dist/radio/source.d.ts +25 -0
  11. package/dist/radio/source.d.ts.map +1 -0
  12. package/dist/radio/source.js +69 -0
  13. package/dist/radio/source.js.map +1 -0
  14. package/dist/radio.d.ts +2 -1
  15. package/dist/radio.d.ts.map +1 -1
  16. package/dist/radio.js +1 -1
  17. package/dist/radio.js.map +1 -1
  18. package/dist/rtlsdr/rtl2832u.d.ts.map +1 -1
  19. package/dist/rtlsdr/rtl2832u.js.map +1 -1
  20. package/dist/rtlsdr/rtlcom.d.ts.map +1 -1
  21. package/dist/rtlsdr/rtlcom.js.map +1 -1
  22. package/package.json +4 -4
  23. package/dist/demod/demod-am.d.ts +0 -54
  24. package/dist/demod/demod-am.d.ts.map +0 -1
  25. package/dist/demod/demod-am.js +0 -113
  26. package/dist/demod/demod-am.js.map +0 -1
  27. package/dist/demod/demod-cw.d.ts +0 -48
  28. package/dist/demod/demod-cw.d.ts.map +0 -1
  29. package/dist/demod/demod-cw.js +0 -101
  30. package/dist/demod/demod-cw.js.map +0 -1
  31. package/dist/demod/demod-nbfm.d.ts +0 -54
  32. package/dist/demod/demod-nbfm.d.ts.map +0 -1
  33. package/dist/demod/demod-nbfm.js +0 -114
  34. package/dist/demod/demod-nbfm.js.map +0 -1
  35. package/dist/demod/demod-ssb.d.ts +0 -55
  36. package/dist/demod/demod-ssb.d.ts.map +0 -1
  37. package/dist/demod/demod-ssb.js +0 -112
  38. package/dist/demod/demod-ssb.js.map +0 -1
  39. package/dist/demod/demod-wbfm.d.ts +0 -113
  40. package/dist/demod/demod-wbfm.d.ts.map +0 -1
  41. package/dist/demod/demod-wbfm.js +0 -212
  42. package/dist/demod/demod-wbfm.js.map +0 -1
  43. package/dist/demod/demodulator.d.ts +0 -3
  44. package/dist/demod/demodulator.d.ts.map +0 -1
  45. package/dist/demod/demodulator.js +0 -28
  46. package/dist/demod/demodulator.js.map +0 -1
  47. package/dist/demod/empty-demodulator.d.ts +0 -82
  48. package/dist/demod/empty-demodulator.d.ts.map +0 -1
  49. package/dist/demod/empty-demodulator.js +0 -149
  50. package/dist/demod/empty-demodulator.js.map +0 -1
  51. package/dist/demod/modes.d.ts +0 -107
  52. package/dist/demod/modes.d.ts.map +0 -1
  53. package/dist/demod/modes.js +0 -101
  54. package/dist/demod/modes.js.map +0 -1
  55. package/dist/demod/player.d.ts +0 -19
  56. package/dist/demod/player.d.ts.map +0 -1
  57. package/dist/demod/player.js +0 -15
  58. package/dist/demod/player.js.map +0 -1
  59. package/dist/demod/sample-counter.d.ts +0 -22
  60. package/dist/demod/sample-counter.d.ts.map +0 -1
  61. package/dist/demod/sample-counter.js +0 -57
  62. package/dist/demod/sample-counter.js.map +0 -1
  63. package/dist/demod/spectrum.d.ts +0 -23
  64. package/dist/demod/spectrum.d.ts.map +0 -1
  65. package/dist/demod/spectrum.js +0 -78
  66. package/dist/demod/spectrum.js.map +0 -1
  67. package/dist/dsp/buffers.d.ts +0 -72
  68. package/dist/dsp/buffers.d.ts.map +0 -1
  69. package/dist/dsp/buffers.js +0 -122
  70. package/dist/dsp/buffers.js.map +0 -1
  71. package/dist/dsp/coefficients.d.ts +0 -22
  72. package/dist/dsp/coefficients.d.ts.map +0 -1
  73. package/dist/dsp/coefficients.js +0 -77
  74. package/dist/dsp/coefficients.js.map +0 -1
  75. package/dist/dsp/converters.d.ts +0 -15
  76. package/dist/dsp/converters.d.ts.map +0 -1
  77. package/dist/dsp/converters.js +0 -43
  78. package/dist/dsp/converters.js.map +0 -1
  79. package/dist/dsp/demodulators.d.ts +0 -73
  80. package/dist/dsp/demodulators.d.ts.map +0 -1
  81. package/dist/dsp/demodulators.js +0 -244
  82. package/dist/dsp/demodulators.js.map +0 -1
  83. package/dist/dsp/fft.d.ts +0 -53
  84. package/dist/dsp/fft.d.ts.map +0 -1
  85. package/dist/dsp/fft.js +0 -175
  86. package/dist/dsp/fft.js.map +0 -1
  87. package/dist/dsp/filters.d.ts +0 -91
  88. package/dist/dsp/filters.d.ts.map +0 -1
  89. package/dist/dsp/filters.js +0 -250
  90. package/dist/dsp/filters.js.map +0 -1
  91. package/dist/dsp/power.d.ts +0 -2
  92. package/dist/dsp/power.d.ts.map +0 -1
  93. package/dist/dsp/power.js +0 -23
  94. package/dist/dsp/power.js.map +0 -1
  95. package/dist/dsp/resamplers.d.ts +0 -33
  96. package/dist/dsp/resamplers.d.ts.map +0 -1
  97. package/dist/dsp/resamplers.js +0 -91
  98. package/dist/dsp/resamplers.js.map +0 -1
  99. package/dist/players/audioplayer.d.ts +0 -25
  100. package/dist/players/audioplayer.d.ts.map +0 -1
  101. package/dist/players/audioplayer.js +0 -68
  102. package/dist/players/audioplayer.js.map +0 -1
  103. package/dist/radio/msgqueue.d.ts +0 -23
  104. package/dist/radio/msgqueue.d.ts.map +0 -1
  105. package/dist/radio/msgqueue.js +0 -52
  106. package/dist/radio/msgqueue.js.map +0 -1
  107. package/dist/radio/sample_receiver.d.ts +0 -19
  108. package/dist/radio/sample_receiver.d.ts.map +0 -1
  109. package/dist/radio/sample_receiver.js +0 -54
  110. package/dist/radio/sample_receiver.js.map +0 -1
@@ -1,101 +0,0 @@
1
- // Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- /**
15
- * Registers a modulation scheme. If a modulation scheme by that name already exists, it is replaced.
16
- * @param name the name of the modulation scheme. Must match the content of `scheme` in the mode.
17
- * @param demod the constructor of the Demod class.
18
- * @param config the constructor of the Configurator class.
19
- */
20
- export function registerDemod(name, demod, config) {
21
- registeredDemods.set(name, { demod: demod, config: config });
22
- }
23
- /** Unregisters a modulation scheme. */
24
- export function unregisterDemod(name) {
25
- registeredDemods.delete(name);
26
- }
27
- /** Returns the list of registered modulation schemes, in the order in which they were registered. */
28
- export function getSchemes() {
29
- return [...registeredDemods.keys()];
30
- }
31
- /** Returns the default mode for the given scheme name. */
32
- export function getMode(scheme) {
33
- let reg = getRegisteredDemod(scheme);
34
- return new reg.config(scheme).mode;
35
- }
36
- /** Returns a Scheme object for the given mode. */
37
- export function getDemod(inRate, outRate, mode, options) {
38
- let reg = getRegisteredDemod(mode);
39
- return new reg.demod(inRate, outRate, mode, options);
40
- }
41
- export function modeParameters(mode) {
42
- let reg = getRegisteredDemod(mode);
43
- return new reg.config(mode);
44
- }
45
- /** A base for classes that inspect and modify a mode parameters object. */
46
- export class Configurator {
47
- base;
48
- constructor(base) {
49
- this.base = base;
50
- }
51
- get mode() {
52
- if (typeof this.base === "string") {
53
- this.base = this.create(this.base);
54
- }
55
- return this.base;
56
- }
57
- set mode(mode) {
58
- this.base = mode;
59
- }
60
- /** Returns whether stereo output is settable in this mode. */
61
- hasStereo() {
62
- return false;
63
- }
64
- /** Returns whether stereo output is enabled. */
65
- getStereo() {
66
- return false;
67
- }
68
- /** Enables or disables stereo output. */
69
- setStereo(stereo) {
70
- return this;
71
- }
72
- /** Returns whether the bandwidth is settable in this mode. */
73
- hasBandwidth() {
74
- return false;
75
- }
76
- /** Changes the bandwidth used by this mode. */
77
- setBandwidth(bandwidth) {
78
- return this;
79
- }
80
- /** Returns whether the squelch level is settable. */
81
- hasSquelch() {
82
- return false;
83
- }
84
- /** Returns the current squelch level. */
85
- getSquelch() {
86
- return 0;
87
- }
88
- /** Sets the squelch level. */
89
- setSquelch(squelch) {
90
- return this;
91
- }
92
- }
93
- var registeredDemods = new Map();
94
- function getRegisteredDemod(mode) {
95
- let scheme = typeof mode === "string" ? mode : mode.scheme;
96
- let reg = registeredDemods.get(scheme);
97
- if (!reg)
98
- throw `Scheme "${scheme}" was not registered.`;
99
- return reg;
100
- }
101
- //# sourceMappingURL=modes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modes.js","sourceRoot":"","sources":["../../src/demod/modes.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AA0DjC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAiB,EACjB,KAA0B,EAC1B,MAA4B;IAE5B,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,UAAU;IACxB,OAAO,CAAC,GAAG,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,IAAI,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IA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IACf,CAAC;IACD,yCAAyC;IACzC,UAAU;QACR,OAAO,CAAC,CAAC;IACX,CAAC;IACD,8BAA8B;IAC9B,UAAU,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAmBD,IAAI,gBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAC;AAE1D,SAAS,kBAAkB,CAAC,IAAmB;IAC7C,IAAI,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC3D,IAAI,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG;QAAE,MAAM,WAAW,MAAM,uBAAuB,CAAC;IACzD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,19 +0,0 @@
1
- /** Interface for classes that get audio samples from a Demodulator class. */
2
- export interface Player {
3
- /** The sample rate this class expects. The demodulator will call 'play' with samples at this rate. */
4
- readonly sampleRate: number;
5
- /**
6
- * Outputs the given audio samples.
7
- * @param left The samples for the left speaker.
8
- * @param right The samples for the right speaker.
9
- */
10
- play(left: Float32Array, right: Float32Array): void;
11
- /**
12
- * Sets the output volume.
13
- * @param volume The volume to set, a number from 0 (silent) to 1 (full volume).
14
- */
15
- setVolume(volume: number): void;
16
- /** Returns the currently set volume. */
17
- getVolume(): number;
18
- }
19
- //# sourceMappingURL=player.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../src/demod/player.ts"],"names":[],"mappings":"AAcA,6EAA6E;AAC7E,MAAM,WAAW,MAAM;IACrB,sGAAsG;IACtG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAEpD;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,wCAAwC;IACxC,SAAS,IAAI,MAAM,CAAC;CACrB"}
@@ -1,15 +0,0 @@
1
- // Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- export {};
15
- //# sourceMappingURL=player.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"player.js","sourceRoot":"","sources":["../../src/demod/player.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC"}
@@ -1,22 +0,0 @@
1
- import { SampleReceiver } from "../radio.js";
2
- /** A SampleReceiver that counts received samples to send a `sample-click` event periodically. */
3
- export declare class SampleCounter extends EventTarget implements SampleReceiver {
4
- private clicksPerSecond?;
5
- /**
6
- * @param sampleRate The initial sample rate.
7
- * @param clicksPerSecond The number of events per second.
8
- */
9
- constructor(clicksPerSecond?: number | undefined);
10
- private sampleRate;
11
- private samplesPerClick?;
12
- private countedSamples;
13
- private getSamplesPerClick;
14
- setSampleRate(sampleRate: number): void;
15
- receiveSamples(I: Float32Array, Q: Float32Array): void;
16
- addEventListener(type: "sample-click", callback: (e: SampleClickEvent) => void | null, options?: boolean | AddEventListenerOptions | undefined): void;
17
- addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
18
- }
19
- export declare class SampleClickEvent extends Event {
20
- constructor();
21
- }
22
- //# sourceMappingURL=sample-counter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sample-counter.d.ts","sourceRoot":"","sources":["../../src/demod/sample-counter.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,iGAAiG;AACjG,qBAAa,aAAc,SAAQ,WAAY,YAAW,cAAc;IAK1D,OAAO,CAAC,eAAe,CAAC;IAJpC;;;OAGG;gBACiB,eAAe,CAAC,EAAE,MAAM,YAAA;IAO5C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,kBAAkB;IAM1B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKvC,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,IAAI;IAWtD,gBAAgB,CACd,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,EAC9C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAAG,SAAS,GACtD,IAAI;IACP,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,GAAG,IAAI,EACnD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAAG,SAAS,GACtD,IAAI;CAYR;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAI1C"}
@@ -1,57 +0,0 @@
1
- // Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- /** A SampleReceiver that counts received samples to send a `sample-click` event periodically. */
15
- export class SampleCounter extends EventTarget {
16
- clicksPerSecond;
17
- /**
18
- * @param sampleRate The initial sample rate.
19
- * @param clicksPerSecond The number of events per second.
20
- */
21
- constructor(clicksPerSecond) {
22
- super();
23
- this.clicksPerSecond = clicksPerSecond;
24
- this.sampleRate = 1024000;
25
- this.samplesPerClick = this.getSamplesPerClick();
26
- this.countedSamples = 0;
27
- }
28
- sampleRate;
29
- samplesPerClick;
30
- countedSamples;
31
- getSamplesPerClick() {
32
- return this.clicksPerSecond === undefined
33
- ? undefined
34
- : Math.floor(this.sampleRate / this.clicksPerSecond);
35
- }
36
- setSampleRate(sampleRate) {
37
- this.sampleRate = sampleRate;
38
- this.samplesPerClick = this.getSamplesPerClick();
39
- }
40
- receiveSamples(I, Q) {
41
- this.countedSamples += I.length;
42
- if (this.samplesPerClick === undefined ||
43
- this.samplesPerClick > this.countedSamples)
44
- return;
45
- this.countedSamples %= this.samplesPerClick;
46
- this.dispatchEvent(new SampleClickEvent());
47
- }
48
- addEventListener(type, callback, options) {
49
- super.addEventListener(type, callback, options);
50
- }
51
- }
52
- export class SampleClickEvent extends Event {
53
- constructor() {
54
- super("sample-click");
55
- }
56
- }
57
- //# sourceMappingURL=sample-counter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sample-counter.js","sourceRoot":"","sources":["../../src/demod/sample-counter.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,iGAAiG;AACjG,MAAM,OAAO,aAAc,SAAQ,WAAW;IAKxB;IAJpB;;;OAGG;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2
- /** A sample receiver that computes the received signal's spectrum. */
3
- export declare class Spectrum implements SampleReceiver {
4
- constructor(fftSize?: number);
5
- private I;
6
- private Q;
7
- private lastFrequency;
8
- private fft;
9
- private lastOutput;
10
- private dirty;
11
- set size(newSize: number);
12
- get size(): number;
13
- setSampleRate(_: number): void;
14
- receiveSamples(I: Float32Array, Q: Float32Array, frequency: number): void;
15
- frequency(): number | undefined;
16
- /**
17
- * Populates the given array with the spectrum of the latest received signals.
18
- * For best results, the array should have at least `size` entries; if it's smaller,
19
- * it will be filled with whatever fits.
20
- */
21
- getSpectrum(spectrum: Float32Array): void;
22
- }
23
- //# sourceMappingURL=spectrum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spectrum.d.ts","sourceRoot":"","sources":["../../src/demod/spectrum.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,sEAAsE;AACtE,qBAAa,QAAS,YAAW,cAAc;gBACjC,OAAO,CAAC,EAAE,MAAM;IAc5B,OAAO,CAAC,CAAC,CAAoB;IAC7B,OAAO,CAAC,CAAC,CAAoB;IAC7B,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,KAAK,CAAU;IAEvB,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAKvB;IAED,IAAI,IAAI,IAPU,MAAM,CASvB;IAED,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAE9B,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAOzE,SAAS,IAAI,MAAM,GAAG,SAAS;IAI/B;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,YAAY;CAanC"}
@@ -1,78 +0,0 @@
1
- // Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- // Continuous spectrum analyzer.
15
- import { Float32RingBuffer } from "../dsp/buffers.js";
16
- import { makeBlackmanWindow } from "../dsp/coefficients.js";
17
- import { FFT } from "../dsp/fft.js";
18
- /** A sample receiver that computes the received signal's spectrum. */
19
- export class Spectrum {
20
- constructor(fftSize) {
21
- if (fftSize === undefined) {
22
- fftSize = 2048;
23
- }
24
- else {
25
- fftSize = Math.max(32, Math.min(131072, fftSize));
26
- }
27
- this.I = new Float32RingBuffer(131072);
28
- this.Q = new Float32RingBuffer(131072);
29
- this.fft = FFT.ofLength(fftSize);
30
- this.fft.setWindow(makeBlackmanWindow(this.fft.length));
31
- this.lastOutput = new Float32Array(this.fft.length);
32
- this.dirty = true;
33
- }
34
- I;
35
- Q;
36
- lastFrequency;
37
- fft;
38
- lastOutput;
39
- dirty;
40
- set size(newSize) {
41
- this.fft = FFT.ofLength(newSize);
42
- this.fft.setWindow(makeBlackmanWindow(this.fft.length));
43
- this.lastOutput = new Float32Array(this.fft.length);
44
- this.dirty = true;
45
- }
46
- get size() {
47
- return this.fft.length;
48
- }
49
- setSampleRate(_) { }
50
- receiveSamples(I, Q, frequency) {
51
- this.I.store(I);
52
- this.Q.store(Q);
53
- this.lastFrequency = frequency;
54
- this.dirty = true;
55
- }
56
- frequency() {
57
- return this.lastFrequency;
58
- }
59
- /**
60
- * Populates the given array with the spectrum of the latest received signals.
61
- * For best results, the array should have at least `size` entries; if it's smaller,
62
- * it will be filled with whatever fits.
63
- */
64
- getSpectrum(spectrum) {
65
- if (this.dirty) {
66
- let fft = this.fft.transformCircularBuffers(this.I, this.Q);
67
- this.lastOutput.fill(-Infinity);
68
- for (let i = 0; i < this.lastOutput.length; ++i) {
69
- this.lastOutput[i] =
70
- 10 *
71
- Math.log10(fft.real[i] * fft.real[i] + fft.imag[i] * fft.imag[i]);
72
- }
73
- this.dirty = false;
74
- }
75
- spectrum.set(this.lastOutput.subarray(0, spectrum.length));
76
- }
77
- }
78
- //# sourceMappingURL=spectrum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spectrum.js","sourceRoot":"","sources":["../../src/demod/spectrum.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,gCAAgC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,sEAAsE;AACtE,MAAM,OAAO,QAAQ;IACnB,YAAY,OAAgB;QAC1B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,CAAC,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,CAAC,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,SAA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,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YAC5D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;YAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;gBAChD,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBAChB,EAAE;wBACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;QACD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -1,72 +0,0 @@
1
- /**
2
- * A source of pre-allocated arrays of a given size.
3
- */
4
- declare abstract class Buffer<T extends ArrayLike<number>> {
5
- private make;
6
- /**
7
- * @param make A function that returns an array of the given length.
8
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
9
- * @param length An optional initial length for the arrays.
10
- */
11
- constructor(make: (length: number) => T, count: number, length?: number);
12
- private buffers;
13
- private current;
14
- /** Returns an array of the given size. You may need to clear it manually. */
15
- get(length: number): T;
16
- }
17
- /**
18
- * A source of pre-allocated Uint8Array buffers of a given size.
19
- */
20
- export declare class U8Buffer extends Buffer<Uint8Array> {
21
- /**
22
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
23
- * @param length An optional initial size for the buffers.
24
- */
25
- constructor(count: number, length?: number);
26
- }
27
- /**
28
- * A source of pre-allocated Float32Array buffers of a given size.
29
- */
30
- export declare class Float32Buffer extends Buffer<Float32Array> {
31
- /**
32
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
33
- * @param length An optional initial size for the buffers.
34
- */
35
- constructor(count: number, length?: number);
36
- }
37
- /**
38
- * A source of pre-allocated [Float32Array, Float32Array] buffers of a given size.
39
- */
40
- export declare class IqBuffer {
41
- /**
42
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
43
- * @param length An optional initial size for the buffers.
44
- */
45
- constructor(count: number, length?: number);
46
- private buffers;
47
- /** Returns a pair of arrays of the given size. You may need to clear them manually. */
48
- get(length: number): [Float32Array, Float32Array];
49
- }
50
- interface TypedArray<T> extends ArrayLike<number> {
51
- set(array: ArrayLike<number>, offset?: number): void;
52
- subarray(begin?: number, end?: number): T;
53
- }
54
- /**
55
- * A ring buffer, where you can store data and then copy out the latest N values.
56
- */
57
- declare class RingBuffer<T extends TypedArray<T>> {
58
- private buffer;
59
- constructor(buffer: T);
60
- private position;
61
- store(data: T): void;
62
- copyTo(data: T): void;
63
- private doCopy;
64
- }
65
- /**
66
- * A Float32 ring buffer, where you can store data and then copy out the latest N values.
67
- */
68
- export declare class Float32RingBuffer extends RingBuffer<Float32Array> {
69
- constructor(size: number);
70
- }
71
- export {};
72
- //# sourceMappingURL=buffers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffers.d.ts","sourceRoot":"","sources":["../../src/dsp/buffers.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,uBAAe,MAAM,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC;IAO7C,OAAO,CAAC,IAAI;IANd;;;;OAIG;gBAEO,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EACnC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM;IAMjB,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAA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1
- // Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- /**
15
- * A source of pre-allocated arrays of a given size.
16
- */
17
- class Buffer {
18
- make;
19
- /**
20
- * @param make A function that returns an array of the given length.
21
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
22
- * @param length An optional initial length for the arrays.
23
- */
24
- constructor(make, count, length) {
25
- this.make = make;
26
- this.buffers = [...Array(count).keys()].map(() => make(length || 0));
27
- this.current = 0;
28
- }
29
- buffers;
30
- current;
31
- /** Returns an array of the given size. You may need to clear it manually. */
32
- get(length) {
33
- let out = this.buffers[this.current];
34
- if (out.length != length) {
35
- out = this.make(length);
36
- this.buffers[this.current] = out;
37
- }
38
- this.current = (this.current + 1) % this.buffers.length;
39
- return out;
40
- }
41
- }
42
- /**
43
- * A source of pre-allocated Uint8Array buffers of a given size.
44
- */
45
- export class U8Buffer extends Buffer {
46
- /**
47
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
48
- * @param length An optional initial size for the buffers.
49
- */
50
- constructor(count, length) {
51
- super((l) => new Uint8Array(l), count, length);
52
- }
53
- }
54
- /**
55
- * A source of pre-allocated Float32Array buffers of a given size.
56
- */
57
- export class Float32Buffer extends Buffer {
58
- /**
59
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
60
- * @param length An optional initial size for the buffers.
61
- */
62
- constructor(count, length) {
63
- super((l) => new Float32Array(l), count, length);
64
- }
65
- }
66
- /**
67
- * A source of pre-allocated [Float32Array, Float32Array] buffers of a given size.
68
- */
69
- export class IqBuffer {
70
- /**
71
- * @param count The number of buffers to keep around. Having more than 1 lets you modify one buffer while you use another.
72
- * @param length An optional initial size for the buffers.
73
- */
74
- constructor(count, length) {
75
- this.buffers = new Float32Buffer(count * 2, length);
76
- }
77
- buffers;
78
- /** Returns a pair of arrays of the given size. You may need to clear them manually. */
79
- get(length) {
80
- return [this.buffers.get(length), this.buffers.get(length)];
81
- }
82
- }
83
- /**
84
- * A ring buffer, where you can store data and then copy out the latest N values.
85
- */
86
- class RingBuffer {
87
- buffer;
88
- constructor(buffer) {
89
- this.buffer = buffer;
90
- this.position = 0;
91
- }
92
- position;
93
- store(data) {
94
- let count = Math.min(data.length, data.length, this.buffer.length);
95
- let { dstOffset } = this.doCopy(count, data, 0, this.buffer, this.position);
96
- this.position = dstOffset;
97
- }
98
- copyTo(data) {
99
- let count = Math.min(data.length, this.buffer.length, data.length);
100
- let srcOffset = (this.position + this.buffer.length - count) % this.buffer.length;
101
- this.doCopy(count, this.buffer, srcOffset, data, 0);
102
- }
103
- doCopy(count, src, srcOffset, dst, dstOffset) {
104
- while (count > 0) {
105
- const copyCount = Math.min(count, src.length - srcOffset, dst.length - dstOffset);
106
- dst.set(src.subarray(srcOffset, srcOffset + copyCount), dstOffset);
107
- srcOffset = (srcOffset + copyCount) % src.length;
108
- dstOffset = (dstOffset + copyCount) % dst.length;
109
- count -= copyCount;
110
- }
111
- return { srcOffset, dstOffset };
112
- }
113
- }
114
- /**
115
- * A Float32 ring buffer, where you can store data and then copy out the latest N values.
116
- */
117
- export class Float32RingBuffer extends RingBuffer {
118
- constructor(size) {
119
- super(new Float32Array(size));
120
- }
121
- }
122
- //# sourceMappingURL=buffers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buffers.js","sourceRoot":"","sources":["../../src/dsp/buffers.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDA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AM,CAAC,CAAC;QACnE,IAAI,SAAS,GACX,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACpE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IAEO,MAAM,CACZ,KAAa,EACb,GAAM,EACN,SAAiB,EACjB,GAAM,EACN,SAAiB;QAEjB,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CACxB,KAAK,EACL,GAAG,CAAC,MAAM,GAAG,SAAS,EACtB,GAAG,CAAC,MAAM,GAAG,SAAS,CACvB,CAAC;YACF,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;YACnE,SAAS,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;YACjD,SAAS,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;YACjD,KAAK,IAAI,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAClC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAwB;IAC7D,YAAY,IAAY;QACtB,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Generates coefficients for a FIR low-pass filter with the given
3
- * corner frequency and kernel length at the given sample rate.
4
- * @param sampleRate The signal's sample rate.
5
- * @param cornerFreq The -3dB frequency in Hz.
6
- * @param length The filter kernel's length. Should be an odd number.
7
- * @returns The FIR coefficients for the filter.
8
- */
9
- export declare function makeLowPassKernel(sampleRate: number, cornerFreq: number, length: number): Float32Array;
10
- /**
11
- * Returns coefficients for a Hilbert transform.
12
- * @param length The length of the kernel.
13
- * @returns The kernel coefficients.
14
- */
15
- export declare function makeHilbertKernel(length: number): Float32Array;
16
- /**
17
- * Returns coefficients for a Blackman window.
18
- * @param length The length of the kernel.
19
- * @returns The kernel coefficients.
20
- */
21
- export declare function makeBlackmanWindow(length: number): Float32Array;
22
- //# sourceMappingURL=coefficients.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coefficients.d.ts","sourceRoot":"","sources":["../../src/dsp/coefficients.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,YAAY,CAqBd;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAU9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS/D"}