@jtarrio/webrtlsdr 2.0.5 → 3.0.0
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.
- package/README.md +5 -6
- package/dist/errors.d.ts +1 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +0 -1
- package/dist/errors.js.map +1 -1
- package/dist/radio/radio.d.ts +22 -63
- package/dist/radio/radio.d.ts.map +1 -1
- package/dist/radio/radio.js +41 -255
- package/dist/radio/radio.js.map +1 -1
- package/dist/radio/source.d.ts +25 -0
- package/dist/radio/source.d.ts.map +1 -0
- package/dist/radio/source.js +69 -0
- package/dist/radio/source.js.map +1 -0
- package/dist/radio.d.ts +2 -1
- package/dist/radio.d.ts.map +1 -1
- package/dist/radio.js +1 -1
- package/dist/radio.js.map +1 -1
- package/dist/rtlsdr/rtl2832u.d.ts.map +1 -1
- package/dist/rtlsdr/rtl2832u.js.map +1 -1
- package/dist/rtlsdr/rtlcom.d.ts.map +1 -1
- package/dist/rtlsdr/rtlcom.js.map +1 -1
- package/package.json +4 -4
- package/dist/demod/demod-am.d.ts +0 -54
- package/dist/demod/demod-am.d.ts.map +0 -1
- package/dist/demod/demod-am.js +0 -113
- package/dist/demod/demod-am.js.map +0 -1
- package/dist/demod/demod-cw.d.ts +0 -48
- package/dist/demod/demod-cw.d.ts.map +0 -1
- package/dist/demod/demod-cw.js +0 -101
- package/dist/demod/demod-cw.js.map +0 -1
- package/dist/demod/demod-nbfm.d.ts +0 -54
- package/dist/demod/demod-nbfm.d.ts.map +0 -1
- package/dist/demod/demod-nbfm.js +0 -114
- package/dist/demod/demod-nbfm.js.map +0 -1
- package/dist/demod/demod-ssb.d.ts +0 -55
- package/dist/demod/demod-ssb.d.ts.map +0 -1
- package/dist/demod/demod-ssb.js +0 -112
- package/dist/demod/demod-ssb.js.map +0 -1
- package/dist/demod/demod-wbfm.d.ts +0 -113
- package/dist/demod/demod-wbfm.d.ts.map +0 -1
- package/dist/demod/demod-wbfm.js +0 -212
- package/dist/demod/demod-wbfm.js.map +0 -1
- package/dist/demod/demodulator.d.ts +0 -3
- package/dist/demod/demodulator.d.ts.map +0 -1
- package/dist/demod/demodulator.js +0 -28
- package/dist/demod/demodulator.js.map +0 -1
- package/dist/demod/empty-demodulator.d.ts +0 -82
- package/dist/demod/empty-demodulator.d.ts.map +0 -1
- package/dist/demod/empty-demodulator.js +0 -149
- package/dist/demod/empty-demodulator.js.map +0 -1
- package/dist/demod/modes.d.ts +0 -107
- package/dist/demod/modes.d.ts.map +0 -1
- package/dist/demod/modes.js +0 -101
- package/dist/demod/modes.js.map +0 -1
- package/dist/demod/player.d.ts +0 -19
- package/dist/demod/player.d.ts.map +0 -1
- package/dist/demod/player.js +0 -15
- package/dist/demod/player.js.map +0 -1
- package/dist/demod/sample-counter.d.ts +0 -22
- package/dist/demod/sample-counter.d.ts.map +0 -1
- package/dist/demod/sample-counter.js +0 -57
- package/dist/demod/sample-counter.js.map +0 -1
- package/dist/demod/spectrum.d.ts +0 -23
- package/dist/demod/spectrum.d.ts.map +0 -1
- package/dist/demod/spectrum.js +0 -78
- package/dist/demod/spectrum.js.map +0 -1
- package/dist/dsp/buffers.d.ts +0 -72
- package/dist/dsp/buffers.d.ts.map +0 -1
- package/dist/dsp/buffers.js +0 -122
- package/dist/dsp/buffers.js.map +0 -1
- package/dist/dsp/coefficients.d.ts +0 -22
- package/dist/dsp/coefficients.d.ts.map +0 -1
- package/dist/dsp/coefficients.js +0 -77
- package/dist/dsp/coefficients.js.map +0 -1
- package/dist/dsp/converters.d.ts +0 -15
- package/dist/dsp/converters.d.ts.map +0 -1
- package/dist/dsp/converters.js +0 -43
- package/dist/dsp/converters.js.map +0 -1
- package/dist/dsp/demodulators.d.ts +0 -73
- package/dist/dsp/demodulators.d.ts.map +0 -1
- package/dist/dsp/demodulators.js +0 -244
- package/dist/dsp/demodulators.js.map +0 -1
- package/dist/dsp/fft.d.ts +0 -53
- package/dist/dsp/fft.d.ts.map +0 -1
- package/dist/dsp/fft.js +0 -175
- package/dist/dsp/fft.js.map +0 -1
- package/dist/dsp/filters.d.ts +0 -91
- package/dist/dsp/filters.d.ts.map +0 -1
- package/dist/dsp/filters.js +0 -250
- package/dist/dsp/filters.js.map +0 -1
- package/dist/dsp/power.d.ts +0 -2
- package/dist/dsp/power.d.ts.map +0 -1
- package/dist/dsp/power.js +0 -23
- package/dist/dsp/power.js.map +0 -1
- package/dist/dsp/resamplers.d.ts +0 -33
- package/dist/dsp/resamplers.d.ts.map +0 -1
- package/dist/dsp/resamplers.js +0 -91
- package/dist/dsp/resamplers.js.map +0 -1
- package/dist/players/audioplayer.d.ts +0 -25
- package/dist/players/audioplayer.d.ts.map +0 -1
- package/dist/players/audioplayer.js +0 -68
- package/dist/players/audioplayer.js.map +0 -1
- package/dist/radio/msgqueue.d.ts +0 -23
- package/dist/radio/msgqueue.d.ts.map +0 -1
- package/dist/radio/msgqueue.js +0 -52
- package/dist/radio/msgqueue.js.map +0 -1
- package/dist/radio/sample_receiver.d.ts +0 -19
- package/dist/radio/sample_receiver.d.ts.map +0 -1
- package/dist/radio/sample_receiver.js +0 -54
- package/dist/radio/sample_receiver.js.map +0 -1
package/dist/dsp/fft.js
DELETED
|
@@ -1,175 +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
|
-
import { IqBuffer } from "./buffers.js";
|
|
15
|
-
/** Fast Fourier Transform implementation. */
|
|
16
|
-
/**
|
|
17
|
-
* Returns the length of the FFT for a given array length.
|
|
18
|
-
*
|
|
19
|
-
* This FFT implementation only works in power-of-2 lengths,
|
|
20
|
-
* so this function returns the next available length.
|
|
21
|
-
*/
|
|
22
|
-
export function actualLength(minimumLength) {
|
|
23
|
-
if (minimumLength < 2)
|
|
24
|
-
return 0;
|
|
25
|
-
if (((minimumLength - 1) & minimumLength) == 0)
|
|
26
|
-
return minimumLength;
|
|
27
|
-
let realLength = 1;
|
|
28
|
-
while (realLength < minimumLength)
|
|
29
|
-
realLength <<= 1;
|
|
30
|
-
return realLength;
|
|
31
|
-
}
|
|
32
|
-
/** Fast Fourier Transform and reverse transform with a given length. */
|
|
33
|
-
export class FFT {
|
|
34
|
-
length;
|
|
35
|
-
/**
|
|
36
|
-
* Returns an FFT instance that fits the given length.
|
|
37
|
-
*
|
|
38
|
-
* The actual length may be greater than the given length if it
|
|
39
|
-
* is not a power of 2.
|
|
40
|
-
*/
|
|
41
|
-
static ofLength(minimumLength) {
|
|
42
|
-
return new FFT(actualLength(minimumLength));
|
|
43
|
-
}
|
|
44
|
-
constructor(length) {
|
|
45
|
-
this.length = length;
|
|
46
|
-
this.revIndex = reversedBitIndices(length);
|
|
47
|
-
let [fwd, bwd] = makeFftCoefficients(length);
|
|
48
|
-
this.fwd = fwd;
|
|
49
|
-
this.bwd = bwd;
|
|
50
|
-
this.copy = new IqBuffer(2, length);
|
|
51
|
-
this.out = new IqBuffer(2, length);
|
|
52
|
-
this.window = new Float32Array(length);
|
|
53
|
-
this.window.fill(1);
|
|
54
|
-
}
|
|
55
|
-
revIndex;
|
|
56
|
-
fwd;
|
|
57
|
-
bwd;
|
|
58
|
-
copy;
|
|
59
|
-
out;
|
|
60
|
-
window;
|
|
61
|
-
/** Sets the window function for this FFT. */
|
|
62
|
-
setWindow(window) {
|
|
63
|
-
this.window.set(window);
|
|
64
|
-
}
|
|
65
|
-
transform(real, imag) {
|
|
66
|
-
const length = this.length;
|
|
67
|
-
let [outReal, outImag] = this.out.get(length);
|
|
68
|
-
outReal.fill(0);
|
|
69
|
-
outImag.fill(0);
|
|
70
|
-
for (let i = 0; i < length && i < real.length && i < imag.length; ++i) {
|
|
71
|
-
const ri = this.revIndex[i];
|
|
72
|
-
outReal[ri] = (this.window[i] * real[i]) / length;
|
|
73
|
-
outImag[ri] = (this.window[i] * imag[i]) / length;
|
|
74
|
-
}
|
|
75
|
-
doFastTransform(this.length, this.fwd, outReal, outImag);
|
|
76
|
-
return { real: outReal, imag: outImag };
|
|
77
|
-
}
|
|
78
|
-
transformCircularBuffers(real, imag) {
|
|
79
|
-
const length = this.length;
|
|
80
|
-
let [copyReal, copyImag] = this.copy.get(length);
|
|
81
|
-
real.copyTo(copyReal);
|
|
82
|
-
imag.copyTo(copyImag);
|
|
83
|
-
return this.transform(copyReal, copyImag);
|
|
84
|
-
}
|
|
85
|
-
reverse(real, imag) {
|
|
86
|
-
const length = this.length;
|
|
87
|
-
let [outReal, outImag] = this.out.get(length);
|
|
88
|
-
outReal.fill(0);
|
|
89
|
-
outImag.fill(0);
|
|
90
|
-
for (let i = 0; i < length && i < real.length && i < imag.length; ++i) {
|
|
91
|
-
const ri = this.revIndex[i];
|
|
92
|
-
outReal[ri] = (this.window[i] * real[i]) / length;
|
|
93
|
-
outImag[ri] = (this.window[i] * imag[i]) / length;
|
|
94
|
-
}
|
|
95
|
-
doFastTransform(this.length, this.bwd, outReal, outImag);
|
|
96
|
-
return { real: outReal, imag: outImag };
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/** Performs a fast direct or reverse transform in place. */
|
|
100
|
-
function doFastTransform(length, coefs, real, imag) {
|
|
101
|
-
for (let dftSize = 2, coeffBin = 0; dftSize <= length; dftSize *= 2, ++coeffBin) {
|
|
102
|
-
const binCoefficients = coefs[coeffBin];
|
|
103
|
-
const halfDftSize = dftSize / 2;
|
|
104
|
-
for (let dftStart = 0; dftStart < length; dftStart += dftSize) {
|
|
105
|
-
for (let i = 0; i < halfDftSize; ++i) {
|
|
106
|
-
const near = dftStart + i;
|
|
107
|
-
const far = near + halfDftSize;
|
|
108
|
-
const evenReal = real[near];
|
|
109
|
-
const evenImag = imag[near];
|
|
110
|
-
const cr = binCoefficients.real[i];
|
|
111
|
-
const ci = binCoefficients.imag[i];
|
|
112
|
-
const or = real[far];
|
|
113
|
-
const oi = imag[far];
|
|
114
|
-
const oddReal = cr * or - ci * oi;
|
|
115
|
-
const oddImag = cr * oi + ci * or;
|
|
116
|
-
real[near] = evenReal + oddReal;
|
|
117
|
-
imag[near] = evenImag + oddImag;
|
|
118
|
-
real[far] = evenReal - oddReal;
|
|
119
|
-
imag[far] = evenImag - oddImag;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/** Builds a triangle of direct and reverse FFT coefficients for the given length. */
|
|
125
|
-
function makeFftCoefficients(length) {
|
|
126
|
-
let numBits = getNumBits(length);
|
|
127
|
-
let fwd = [];
|
|
128
|
-
let bwd = [];
|
|
129
|
-
for (let bin = 0, halfSize = 1; bin < numBits; ++bin, halfSize *= 2) {
|
|
130
|
-
fwd.push({
|
|
131
|
-
real: new Float32Array(halfSize),
|
|
132
|
-
imag: new Float32Array(halfSize),
|
|
133
|
-
});
|
|
134
|
-
bwd.push({
|
|
135
|
-
real: new Float32Array(halfSize),
|
|
136
|
-
imag: new Float32Array(halfSize),
|
|
137
|
-
});
|
|
138
|
-
for (let i = 0; i < halfSize; ++i) {
|
|
139
|
-
const fwdAngle = (-1 * Math.PI * i) / halfSize;
|
|
140
|
-
fwd[bin].real[i] = Math.cos(fwdAngle);
|
|
141
|
-
fwd[bin].imag[i] = Math.sin(fwdAngle);
|
|
142
|
-
const bwdAngle = (Math.PI * i) / halfSize;
|
|
143
|
-
bwd[bin].real[i] = Math.cos(bwdAngle);
|
|
144
|
-
bwd[bin].imag[i] = Math.sin(bwdAngle);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return [fwd, bwd];
|
|
148
|
-
}
|
|
149
|
-
/** Builds an array of numbers with their bits reversed. */
|
|
150
|
-
function reversedBitIndices(length) {
|
|
151
|
-
const numBits = getNumBits(length);
|
|
152
|
-
let output = new Int32Array(length);
|
|
153
|
-
for (let i = 0; i < length; ++i) {
|
|
154
|
-
output[i] = reverseBits(i, numBits);
|
|
155
|
-
}
|
|
156
|
-
return output;
|
|
157
|
-
}
|
|
158
|
-
/** Returns how many bits we need to fit 'length' distinct values. */
|
|
159
|
-
function getNumBits(length) {
|
|
160
|
-
let numBits = 0;
|
|
161
|
-
for (let shifted = length - 1; shifted > 0; shifted >>= 1)
|
|
162
|
-
++numBits;
|
|
163
|
-
return numBits;
|
|
164
|
-
}
|
|
165
|
-
/** Reverses the bits in a number. */
|
|
166
|
-
function reverseBits(num, bits) {
|
|
167
|
-
let output = 0;
|
|
168
|
-
for (let b = 0; b < bits; ++b) {
|
|
169
|
-
output <<= 1;
|
|
170
|
-
output |= num & 1;
|
|
171
|
-
num >>= 1;
|
|
172
|
-
}
|
|
173
|
-
return output;
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=fft.js.map
|
package/dist/dsp/fft.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fft.js","sourceRoot":"","sources":["../../src/dsp/fft.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,OAAO,EAAqB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3D,6CAA6C;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,aAAqB;IAChD,IAAI,aAAa,GAAG,CAAC;QAAE,OAA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|
|
|
1
|
-
export interface Filter {
|
|
2
|
-
/** Returns a newly initialized clone of this filter. */
|
|
3
|
-
clone(): Filter;
|
|
4
|
-
/** Returns this filter's delay, in samples. */
|
|
5
|
-
delay(): number;
|
|
6
|
-
/** Applies the filter to the input samples, in place. */
|
|
7
|
-
inPlace(samples: Float32Array): void;
|
|
8
|
-
}
|
|
9
|
-
/** A class to apply a FIR filter to a sequence of samples. */
|
|
10
|
-
export declare class FIRFilter implements Filter {
|
|
11
|
-
private coefs;
|
|
12
|
-
/** @param coefs The coefficients of the filter to apply. */
|
|
13
|
-
constructor(coefs: Float32Array);
|
|
14
|
-
private offset;
|
|
15
|
-
private center;
|
|
16
|
-
private curSamples;
|
|
17
|
-
setCoefficients(coefs: Float32Array): void;
|
|
18
|
-
clone(): FIRFilter;
|
|
19
|
-
delay(): number;
|
|
20
|
-
inPlace(samples: Float32Array): void;
|
|
21
|
-
/**
|
|
22
|
-
* Loads a new block of samples to filter.
|
|
23
|
-
* @param samples The samples to load.
|
|
24
|
-
*/
|
|
25
|
-
loadSamples(samples: Float32Array): void;
|
|
26
|
-
/**
|
|
27
|
-
* Returns a filtered sample.
|
|
28
|
-
* Be very careful when you modify this function. About 85% of the total execution
|
|
29
|
-
* time is spent here, so performance is critical.
|
|
30
|
-
* @param index The index of the sample to return, corresponding
|
|
31
|
-
* to the same index in the latest sample block loaded via loadSamples().
|
|
32
|
-
*/
|
|
33
|
-
get(index: number): number;
|
|
34
|
-
/**
|
|
35
|
-
* Returns a delayed sample.
|
|
36
|
-
* @param index The index of the relative sample to return.
|
|
37
|
-
*/
|
|
38
|
-
getDelayed(index: number): number;
|
|
39
|
-
}
|
|
40
|
-
/** Automatic gain control for audio signals. */
|
|
41
|
-
export declare class AGC implements Filter {
|
|
42
|
-
private sampleRate;
|
|
43
|
-
constructor(sampleRate: number, timeConstantSeconds: number, maxGain?: number);
|
|
44
|
-
private dcBlocker;
|
|
45
|
-
private alpha;
|
|
46
|
-
private counter;
|
|
47
|
-
private maxPower;
|
|
48
|
-
private maxGain;
|
|
49
|
-
clone(): AGC;
|
|
50
|
-
delay(): number;
|
|
51
|
-
inPlace(samples: Float32Array): void;
|
|
52
|
-
}
|
|
53
|
-
/** A filter that blocks DC signals. */
|
|
54
|
-
export declare class DcBlocker implements Filter {
|
|
55
|
-
private restricted?;
|
|
56
|
-
constructor(sampleRate: number, restricted?: boolean | undefined);
|
|
57
|
-
private alpha;
|
|
58
|
-
private dc;
|
|
59
|
-
clone(): DcBlocker;
|
|
60
|
-
delay(): number;
|
|
61
|
-
inPlace(samples: Float32Array): void;
|
|
62
|
-
}
|
|
63
|
-
/** A de-emphasis filter with the given time constant. */
|
|
64
|
-
export declare class Deemphasizer implements Filter {
|
|
65
|
-
/**
|
|
66
|
-
* @param sampleRate The signal's sample rate.
|
|
67
|
-
* @param timeConstant_uS The filter's time constant in microseconds.
|
|
68
|
-
*/
|
|
69
|
-
constructor(sampleRate: number, timeConstant_uS: number);
|
|
70
|
-
private alpha;
|
|
71
|
-
private val;
|
|
72
|
-
/** Returns a copy of this deemphasizer. */
|
|
73
|
-
clone(): Deemphasizer;
|
|
74
|
-
delay(): number;
|
|
75
|
-
/**
|
|
76
|
-
* Deemphasizes the given samples in place.
|
|
77
|
-
* @param samples The samples to deemphasize.
|
|
78
|
-
*/
|
|
79
|
-
inPlace(samples: Float32Array): void;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Shifts IQ samples by a given frequency.
|
|
83
|
-
*/
|
|
84
|
-
export declare class FrequencyShifter {
|
|
85
|
-
private sampleRate;
|
|
86
|
-
constructor(sampleRate: number);
|
|
87
|
-
private cosine;
|
|
88
|
-
private sine;
|
|
89
|
-
inPlace(I: Float32Array, Q: Float32Array, freq: number): void;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/dsp/filters.ts"],"names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OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAAS;IAEnB,KAAK,IAAI,SAAS;IAOlB,KAAK,IAAI,MAAM;IAIf,OAAO,CAAC,OAAO,EAAE,YAAY;CAS9B;AAED,yDAAyD;AACzD,qBAAa,YAAa,YAAW,MAAM;IACzC;;;OAGG;gBACS,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAKvD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IAEpB,2CAA2C;IAC3C,KAAK,IAAI,YAAY;IAOrB,KAAK,IAAI,MAAM;IAIf;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,YAAY;CAS9B;AACD;;GAEG;AAEH,qBAAa,gBAAgB;IACf,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM;IAKtC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM;CAgBvD"}
|
package/dist/dsp/filters.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
-
// Copyright 2013 Google Inc. All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
/** A class to apply a FIR filter to a sequence of samples. */
|
|
16
|
-
export class FIRFilter {
|
|
17
|
-
coefs;
|
|
18
|
-
/** @param coefs The coefficients of the filter to apply. */
|
|
19
|
-
constructor(coefs) {
|
|
20
|
-
this.coefs = coefs;
|
|
21
|
-
this.offset = this.coefs.length - 1;
|
|
22
|
-
this.center = Math.floor(this.coefs.length / 2);
|
|
23
|
-
this.curSamples = new Float32Array(this.offset);
|
|
24
|
-
}
|
|
25
|
-
offset;
|
|
26
|
-
center;
|
|
27
|
-
curSamples;
|
|
28
|
-
setCoefficients(coefs) {
|
|
29
|
-
const oldSamples = this.curSamples;
|
|
30
|
-
this.coefs = coefs;
|
|
31
|
-
this.offset = this.coefs.length - 1;
|
|
32
|
-
this.center = Math.floor(this.coefs.length / 2);
|
|
33
|
-
this.curSamples = new Float32Array(this.offset);
|
|
34
|
-
this.loadSamples(oldSamples);
|
|
35
|
-
}
|
|
36
|
-
clone() {
|
|
37
|
-
return new FIRFilter(this.coefs);
|
|
38
|
-
}
|
|
39
|
-
delay() {
|
|
40
|
-
return this.center;
|
|
41
|
-
}
|
|
42
|
-
inPlace(samples) {
|
|
43
|
-
this.loadSamples(samples);
|
|
44
|
-
for (let i = 0; i < samples.length; ++i) {
|
|
45
|
-
samples[i] = this.get(i);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Loads a new block of samples to filter.
|
|
50
|
-
* @param samples The samples to load.
|
|
51
|
-
*/
|
|
52
|
-
loadSamples(samples) {
|
|
53
|
-
const len = samples.length + this.offset;
|
|
54
|
-
if (this.curSamples.length != len) {
|
|
55
|
-
let newSamples = new Float32Array(len);
|
|
56
|
-
newSamples.set(this.curSamples.subarray(this.curSamples.length - this.offset));
|
|
57
|
-
this.curSamples = newSamples;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this.curSamples.copyWithin(0, samples.length);
|
|
61
|
-
}
|
|
62
|
-
this.curSamples.set(samples, this.offset);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Returns a filtered sample.
|
|
66
|
-
* Be very careful when you modify this function. About 85% of the total execution
|
|
67
|
-
* time is spent here, so performance is critical.
|
|
68
|
-
* @param index The index of the sample to return, corresponding
|
|
69
|
-
* to the same index in the latest sample block loaded via loadSamples().
|
|
70
|
-
*/
|
|
71
|
-
get(index) {
|
|
72
|
-
let i = 0;
|
|
73
|
-
let out = 0;
|
|
74
|
-
let len = this.coefs.length;
|
|
75
|
-
let len4 = 4 * Math.floor(len / 4);
|
|
76
|
-
while (i < len4) {
|
|
77
|
-
out +=
|
|
78
|
-
this.coefs[i++] * this.curSamples[index++] +
|
|
79
|
-
this.coefs[i++] * this.curSamples[index++] +
|
|
80
|
-
this.coefs[i++] * this.curSamples[index++] +
|
|
81
|
-
this.coefs[i++] * this.curSamples[index++];
|
|
82
|
-
}
|
|
83
|
-
let len2 = 2 * Math.floor(len / 2);
|
|
84
|
-
while (i < len2) {
|
|
85
|
-
out +=
|
|
86
|
-
this.coefs[i++] * this.curSamples[index++] +
|
|
87
|
-
this.coefs[i++] * this.curSamples[index++];
|
|
88
|
-
}
|
|
89
|
-
while (i < len) {
|
|
90
|
-
out += this.coefs[i++] * this.curSamples[index++];
|
|
91
|
-
}
|
|
92
|
-
return out;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Returns a delayed sample.
|
|
96
|
-
* @param index The index of the relative sample to return.
|
|
97
|
-
*/
|
|
98
|
-
getDelayed(index) {
|
|
99
|
-
return this.curSamples[index + this.center];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/** Automatic gain control for audio signals. */
|
|
103
|
-
export class AGC {
|
|
104
|
-
sampleRate;
|
|
105
|
-
constructor(sampleRate, timeConstantSeconds, maxGain) {
|
|
106
|
-
this.sampleRate = sampleRate;
|
|
107
|
-
this.dcBlocker = new DcBlocker(sampleRate);
|
|
108
|
-
this.alpha = 1 - Math.exp(-1 / (sampleRate * timeConstantSeconds));
|
|
109
|
-
this.counter = 0;
|
|
110
|
-
this.maxPower = 0;
|
|
111
|
-
this.maxGain = maxGain || 100;
|
|
112
|
-
}
|
|
113
|
-
dcBlocker;
|
|
114
|
-
alpha;
|
|
115
|
-
counter;
|
|
116
|
-
maxPower;
|
|
117
|
-
maxGain;
|
|
118
|
-
clone() {
|
|
119
|
-
let copy = new AGC(this.sampleRate, 1, this.maxGain);
|
|
120
|
-
copy.alpha = this.alpha;
|
|
121
|
-
return copy;
|
|
122
|
-
}
|
|
123
|
-
delay() {
|
|
124
|
-
return 0;
|
|
125
|
-
}
|
|
126
|
-
inPlace(samples) {
|
|
127
|
-
const alpha = this.alpha;
|
|
128
|
-
let maxPower = this.maxPower;
|
|
129
|
-
let counter = this.counter;
|
|
130
|
-
let gain;
|
|
131
|
-
this.dcBlocker.inPlace(samples);
|
|
132
|
-
for (let i = 0; i < samples.length; ++i) {
|
|
133
|
-
const v = samples[i];
|
|
134
|
-
const power = v * v;
|
|
135
|
-
if (power > 0.9 * maxPower) {
|
|
136
|
-
counter = this.sampleRate;
|
|
137
|
-
if (power > maxPower) {
|
|
138
|
-
maxPower = power;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else if (counter > 0) {
|
|
142
|
-
--counter;
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
maxPower -= alpha * maxPower;
|
|
146
|
-
}
|
|
147
|
-
gain = Math.min(this.maxGain, 1 / Math.sqrt(maxPower));
|
|
148
|
-
samples[i] *= gain;
|
|
149
|
-
}
|
|
150
|
-
this.maxPower = maxPower;
|
|
151
|
-
this.counter = counter;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/** A filter that blocks DC signals. */
|
|
155
|
-
export class DcBlocker {
|
|
156
|
-
restricted;
|
|
157
|
-
constructor(sampleRate, restricted) {
|
|
158
|
-
this.restricted = restricted;
|
|
159
|
-
this.alpha = 1 - Math.exp(-1 / (sampleRate / 2));
|
|
160
|
-
this.dc = 0;
|
|
161
|
-
this.restricted = this.restricted || false;
|
|
162
|
-
}
|
|
163
|
-
alpha;
|
|
164
|
-
dc;
|
|
165
|
-
clone() {
|
|
166
|
-
let copy = new DcBlocker(1000);
|
|
167
|
-
copy.alpha = this.alpha;
|
|
168
|
-
copy.dc = this.dc;
|
|
169
|
-
return copy;
|
|
170
|
-
}
|
|
171
|
-
delay() {
|
|
172
|
-
return 0;
|
|
173
|
-
}
|
|
174
|
-
inPlace(samples) {
|
|
175
|
-
const alpha = this.alpha;
|
|
176
|
-
let dc = this.dc;
|
|
177
|
-
for (let i = 0; i < samples.length; ++i) {
|
|
178
|
-
dc += alpha * (samples[i] - dc);
|
|
179
|
-
if (!this.restricted || dc * dc < 6e-5)
|
|
180
|
-
samples[i] -= dc;
|
|
181
|
-
}
|
|
182
|
-
this.dc = dc;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/** A de-emphasis filter with the given time constant. */
|
|
186
|
-
export class Deemphasizer {
|
|
187
|
-
/**
|
|
188
|
-
* @param sampleRate The signal's sample rate.
|
|
189
|
-
* @param timeConstant_uS The filter's time constant in microseconds.
|
|
190
|
-
*/
|
|
191
|
-
constructor(sampleRate, timeConstant_uS) {
|
|
192
|
-
this.alpha = 1 - Math.exp(-1 / ((sampleRate * timeConstant_uS) / 1e6));
|
|
193
|
-
this.val = 0;
|
|
194
|
-
}
|
|
195
|
-
alpha;
|
|
196
|
-
val;
|
|
197
|
-
/** Returns a copy of this deemphasizer. */
|
|
198
|
-
clone() {
|
|
199
|
-
let copy = new Deemphasizer(1, 1);
|
|
200
|
-
copy.alpha = this.alpha;
|
|
201
|
-
copy.val = this.val;
|
|
202
|
-
return copy;
|
|
203
|
-
}
|
|
204
|
-
delay() {
|
|
205
|
-
return 0;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Deemphasizes the given samples in place.
|
|
209
|
-
* @param samples The samples to deemphasize.
|
|
210
|
-
*/
|
|
211
|
-
inPlace(samples) {
|
|
212
|
-
const alpha = this.alpha;
|
|
213
|
-
let val = this.val;
|
|
214
|
-
for (let i = 0; i < samples.length; ++i) {
|
|
215
|
-
val += alpha * (samples[i] - val);
|
|
216
|
-
samples[i] = val;
|
|
217
|
-
}
|
|
218
|
-
this.val = val;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Shifts IQ samples by a given frequency.
|
|
223
|
-
*/
|
|
224
|
-
export class FrequencyShifter {
|
|
225
|
-
sampleRate;
|
|
226
|
-
constructor(sampleRate) {
|
|
227
|
-
this.sampleRate = sampleRate;
|
|
228
|
-
this.cosine = 1;
|
|
229
|
-
this.sine = 0;
|
|
230
|
-
}
|
|
231
|
-
cosine;
|
|
232
|
-
sine;
|
|
233
|
-
inPlace(I, Q, freq) {
|
|
234
|
-
let cosine = this.cosine;
|
|
235
|
-
let sine = this.sine;
|
|
236
|
-
const deltaCos = Math.cos((2 * Math.PI * freq) / this.sampleRate);
|
|
237
|
-
const deltaSin = Math.sin((2 * Math.PI * freq) / this.sampleRate);
|
|
238
|
-
for (let i = 0; i < I.length; ++i) {
|
|
239
|
-
const newI = I[i] * cosine - Q[i] * sine;
|
|
240
|
-
Q[i] = I[i] * sine + Q[i] * cosine;
|
|
241
|
-
I[i] = newI;
|
|
242
|
-
const newSine = cosine * deltaSin + sine * deltaCos;
|
|
243
|
-
cosine = cosine * deltaCos - sine * deltaSin;
|
|
244
|
-
sine = newSine;
|
|
245
|
-
}
|
|
246
|
-
this.cosine = cosine;
|
|
247
|
-
this.sine = sine;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
//# sourceMappingURL=filters.js.map
|
package/dist/dsp/filters.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/dsp/filters.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;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Q,GAAG,IAAI,GAAG,QAAQ,CAAC;YACpD,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;YAC7C,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/dsp/power.d.ts
DELETED
package/dist/dsp/power.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"power.d.ts","sourceRoot":"","sources":["../../src/dsp/power.ts"],"names":[],"mappings":"AAcA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,MAAM,CAQjE"}
|
package/dist/dsp/power.js
DELETED
|
@@ -1,23 +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 function getPower(I, Q) {
|
|
15
|
-
let power = 0;
|
|
16
|
-
for (let i = 0; i < I.length; ++i) {
|
|
17
|
-
const vI = I[i];
|
|
18
|
-
const vQ = Q[i];
|
|
19
|
-
power += vI * vI + vQ * vQ;
|
|
20
|
-
}
|
|
21
|
-
return power / I.length;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=power.js.map
|
package/dist/dsp/power.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"power.js","sourceRoot":"","sources":["../../src/dsp/power.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,MAAM,UAAU,QAAQ,CAAC,CAAe,EAAE,CAAe;IACvD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChB,KAAK,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;AAC1B,CAAC"}
|
package/dist/dsp/resamplers.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** A class to convert a real input to a lower sample rate. */
|
|
2
|
-
export declare class RealDownsampler {
|
|
3
|
-
/**
|
|
4
|
-
* @param inRate The input sample rate.
|
|
5
|
-
* @param outRate The output sample rate.
|
|
6
|
-
* @param filterLen The size of the low-pass filter.
|
|
7
|
-
*/
|
|
8
|
-
constructor(inRate: number, outRate: number, filterLen: number);
|
|
9
|
-
private downsampler;
|
|
10
|
-
/**
|
|
11
|
-
* @param input The signal in the original sample rate.
|
|
12
|
-
* @returns The resampled signal.
|
|
13
|
-
*/
|
|
14
|
-
downsample(input: Float32Array): Float32Array;
|
|
15
|
-
}
|
|
16
|
-
/** A class to convert a complex input to a lower sample rate. */
|
|
17
|
-
export declare class ComplexDownsampler {
|
|
18
|
-
/**
|
|
19
|
-
* @param inRate The input sample rate.
|
|
20
|
-
* @param outRate The output sample rate.
|
|
21
|
-
* @param filterLen The size of the low-pass filter.
|
|
22
|
-
*/
|
|
23
|
-
constructor(inRate: number, outRate: number, filterLen: number);
|
|
24
|
-
private downsamplerI;
|
|
25
|
-
private downsamplerQ;
|
|
26
|
-
/**
|
|
27
|
-
* @param I The signal's real component.
|
|
28
|
-
* @param Q The signal's imaginary component.
|
|
29
|
-
* @returns An array with the output's real and imaginary components.
|
|
30
|
-
*/
|
|
31
|
-
downsample(I: Float32Array, Q: Float32Array): [Float32Array, Float32Array];
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=resamplers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resamplers.d.ts","sourceRoot":"","sources":["../../src/dsp/resamplers.ts"],"names":[],"mappings":"AAqDA,8DAA8D;AAC9D,qBAAa,eAAe;IAC1B;;;;OAIG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAK9D,OAAO,CAAC,WAAW,CAAc;IAEjC;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;CAG9C;AAED,iEAAiE;AACjE,qBAAa,kBAAkB;IAC7B;;;;OAIG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM9D,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,YAAY,CAAc;IAElC;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC;CAG3E"}
|