@jtarrio/signals 0.9.7 → 0.9.9
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/dist/demod/demod-wbfm.d.ts.map +1 -1
- package/dist/demod/demod-wbfm.js +2 -2
- package/dist/demod/demod-wbfm.js.map +1 -1
- package/dist/dsp/resamplers.d.ts +75 -25
- package/dist/dsp/resamplers.d.ts.map +1 -1
- package/dist/dsp/resamplers.js +354 -42
- package/dist/dsp/resamplers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demod-wbfm.d.ts","sourceRoot":"","sources":["../../src/demod/demod-wbfm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"demod-wbfm.d.ts","sourceRoot":"","sources":["../../src/demod/demod-wbfm.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D,gCAAgC;AAChC,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3D,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,6CAA6C;AAC7C,qBAAa,SAAU,YAAW,KAAK,CAAC,QAAQ,CAAC;IAU7C,OAAO,CAAC,IAAI;IATd;;;;;OAKG;gBAED,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACP,IAAI,EAAE,QAAQ,EACtB,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,QAAQ;IAInB,OAAO,CAAC,IAAI,EAAE,QAAQ;IAItB;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW;CAkChD;AAED,sCAAsC;AACtC,qBAAa,UAAW,SAAQ,YAAY,CAAC,QAAQ,CAAC;gBACxC,IAAI,EAAE,QAAQ,GAAG,MAAM;IAGnC,SAAS,CAAC,MAAM,IAAI,QAAQ;IAG5B,SAAS,IAAI,OAAO;IAGpB,SAAS,IAAI,OAAO;IAGpB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU;IAItC,YAAY,IAAI,MAAM;CAGvB"}
|
package/dist/demod/demod-wbfm.js
CHANGED
|
@@ -17,7 +17,7 @@ import { makeLowPassKernel } from "../dsp/coefficients.js";
|
|
|
17
17
|
import { FMDemodulator, StereoSeparator } from "../dsp/demodulators.js";
|
|
18
18
|
import { Deemphasis, FrequencyShifter, IqFFTFilter, IqFIRFilter, } from "../dsp/filters.js";
|
|
19
19
|
import { getPower } from "../dsp/power.js";
|
|
20
|
-
import { ComplexDownsampler, RealDownsampler } from "../dsp/resamplers.js";
|
|
20
|
+
import { ComplexDownsampler, RealDownsampler, } from "../dsp/resamplers.js";
|
|
21
21
|
import { Configurator } from "./modes.js";
|
|
22
22
|
/** A demodulator for wideband FM signals. */
|
|
23
23
|
export class DemodWBFM {
|
|
@@ -144,7 +144,7 @@ export class DemodWBFMStage2 {
|
|
|
144
144
|
const filterF = Math.min(15000, outRate / 2);
|
|
145
145
|
const kernel = makeLowPassKernel(inRate, filterF, audioTaps, 1 / 0.9);
|
|
146
146
|
this.monoSampler = new RealDownsampler(inRate, outRate, kernel);
|
|
147
|
-
this.stereoSampler =
|
|
147
|
+
this.stereoSampler = this.monoSampler.clone();
|
|
148
148
|
this.stereoSeparator = new StereoSeparator(inRate, pilotF);
|
|
149
149
|
this.leftDeemph = new Deemphasis(outRate, deemphTc);
|
|
150
150
|
this.rightDeemph = new Deemphasis(outRate, deemphTc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demod-wbfm.js","sourceRoot":"","sources":["../../src/demod/demod-wbfm.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,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,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACL,UAAU,EAIV,gBAAgB,EAChB,WAAW,EAEX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"demod-wbfm.js","sourceRoot":"","sources":["../../src/demod/demod-wbfm.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,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,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACL,UAAU,EAIV,gBAAgB,EAChB,WAAW,EAEX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,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IACD,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IACD,SAAS,CAAC,MAAe;QACvB,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,YAAY;QACV,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/dist/dsp/resamplers.d.ts
CHANGED
|
@@ -1,41 +1,77 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export
|
|
1
|
+
/** Interface for classes that convert real signals between sample rates. */
|
|
2
|
+
export interface RealResampler {
|
|
3
|
+
resample(samples: Float32Array): Float32Array;
|
|
4
|
+
getDelay(): number;
|
|
5
|
+
clone(): RealResampler;
|
|
6
|
+
}
|
|
7
|
+
/** Interface for classes that convert I/Q signals between sample rates. */
|
|
8
|
+
export interface IqResampler {
|
|
9
|
+
resample(I: Float32Array, Q: Float32Array): [Float32Array, Float32Array];
|
|
10
|
+
getDelay(): number;
|
|
11
|
+
clone(): IqResampler;
|
|
12
|
+
}
|
|
13
|
+
/** Options for getRealResampler() and getIqResampler() */
|
|
14
|
+
export type ResamplerOptions = {
|
|
3
15
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param filterLen The size of the low-pass filter.
|
|
16
|
+
* The low-pass cut-off frequency for the filter.
|
|
17
|
+
* If unspecified, the lower of half the input or output sample rate is used.
|
|
7
18
|
*/
|
|
8
|
-
|
|
19
|
+
lowPassFrequency?: number;
|
|
9
20
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param kernel The kernel to apply to the signal before downsampling.
|
|
21
|
+
* The number of taps that should be applied per filter "leg".
|
|
22
|
+
* If unspecified, 101 taps are used.
|
|
13
23
|
*/
|
|
14
|
-
|
|
15
|
-
private downsampler;
|
|
24
|
+
tapsPerLeg?: number;
|
|
16
25
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
26
|
+
* The number of taps for the filter.
|
|
27
|
+
* Takes priority over decimatedTaps, if specified.
|
|
28
|
+
* For a downscaling filter, taps == decimatedTaps.
|
|
29
|
+
* For an upscaling or rescaling filter, taps == decimatedTaps * upscaleFactor
|
|
19
30
|
*/
|
|
20
|
-
|
|
31
|
+
taps?: number;
|
|
32
|
+
/**
|
|
33
|
+
* A gain for the filter.
|
|
34
|
+
* If unspecified, 1 is used.
|
|
35
|
+
*/
|
|
36
|
+
gain?: number;
|
|
37
|
+
/**
|
|
38
|
+
* A FIR kernel to use for the filter.
|
|
39
|
+
* If unspecified, a suitable kernel for the low pass frequency and number of pass is used.
|
|
40
|
+
*/
|
|
41
|
+
kernel?: Float32Array;
|
|
42
|
+
};
|
|
43
|
+
/** Returns a RealResampler that converts signals from the input rate to the output rate. */
|
|
44
|
+
export declare function getRealResampler(inRate: number, outRate: number, options?: ResamplerOptions): RealResampler;
|
|
45
|
+
/** Returns an IqResampler that converts signals from the input rate to the output rate. */
|
|
46
|
+
export declare function getIqResampler(inRate: number, outRate: number, options?: ResamplerOptions): IqResampler;
|
|
47
|
+
/**
|
|
48
|
+
* A class to convert the input to a lower sample rate.
|
|
49
|
+
* @deprecated Use getRealResampler() instead.
|
|
50
|
+
*/
|
|
51
|
+
export declare class RealDownsampler {
|
|
52
|
+
private inRate;
|
|
53
|
+
private outRate;
|
|
54
|
+
constructor(inRate: number, outRate: number, filterSpec: number | Float32Array);
|
|
55
|
+
private ratio;
|
|
56
|
+
private filter;
|
|
57
|
+
private pool;
|
|
58
|
+
downsample(samples: Float32Array): Float32Array;
|
|
21
59
|
getDelay(): number;
|
|
60
|
+
clone(): RealDownsampler;
|
|
22
61
|
}
|
|
23
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* A class to convert a complex input to a lower sample rate.
|
|
64
|
+
* @deprecated Use getIqResampler() instead.
|
|
65
|
+
*/
|
|
24
66
|
export declare class ComplexDownsampler {
|
|
25
67
|
/**
|
|
26
68
|
* @param inRate The input sample rate.
|
|
27
69
|
* @param outRate The output sample rate.
|
|
28
|
-
* @param
|
|
29
|
-
*/
|
|
30
|
-
constructor(inRate: number, outRate: number, filterLen: number);
|
|
31
|
-
/**
|
|
32
|
-
* @param inRate The input sample rate.
|
|
33
|
-
* @param outRate The output sample rate.
|
|
34
|
-
* @param kernel The kernel to apply to the signal before downsampling.
|
|
70
|
+
* @param filterSpec The size or kernel of the low-pass filter to apply to the signal before downsampling.
|
|
35
71
|
*/
|
|
36
|
-
constructor(inRate: number, outRate: number,
|
|
37
|
-
private
|
|
38
|
-
private
|
|
72
|
+
constructor(inRate: number, outRate: number, filterSpec: number | Float32Array);
|
|
73
|
+
private downI;
|
|
74
|
+
private downQ;
|
|
39
75
|
/**
|
|
40
76
|
* @param I The signal's real component.
|
|
41
77
|
* @param Q The signal's imaginary component.
|
|
@@ -44,4 +80,18 @@ export declare class ComplexDownsampler {
|
|
|
44
80
|
downsample(I: Float32Array, Q: Float32Array): [Float32Array, Float32Array];
|
|
45
81
|
getDelay(): number;
|
|
46
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Computes an output sample rate that makes for the simplest rescaler.
|
|
85
|
+
*
|
|
86
|
+
* For example, to resample 1024000 to 336000 samples/sec,
|
|
87
|
+
* the resampler has to upsample 21x and then downsample 64x.
|
|
88
|
+
* However, with a tolerance of 50000 samples/sec, you could instead
|
|
89
|
+
* resample to 384000 samples/sec, which only requires upsampling 3x and downsampling 8x.
|
|
90
|
+
*
|
|
91
|
+
* @param inRate The input sample rate.
|
|
92
|
+
* @param outRate The desired output sample rate.
|
|
93
|
+
* @param tolerance The variation that's allowed for the sample rate (over or under the outRate).
|
|
94
|
+
* @returns The computed sample rate.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getGoodResampleRate(inRate: number, outRate: number, tolerance: number): number;
|
|
47
97
|
//# sourceMappingURL=resamplers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resamplers.d.ts","sourceRoot":"","sources":["../../src/dsp/resamplers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resamplers.d.ts","sourceRoot":"","sources":["../../src/dsp/resamplers.ts"],"names":[],"mappings":"AAoBA,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;IAC9C,QAAQ,IAAI,MAAM,CAAC;IACnB,KAAK,IAAI,aAAa,CAAC;CACxB;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACzE,QAAQ,IAAI,MAAM,CAAC;IACnB,KAAK,IAAI,WAAW,CAAC;CACtB;AAkLD,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,gBAAgB,GACzB,aAAa,CAgCf;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,gBAAgB,GACzB,WAAW,CAEb;AAED;;;GAGG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;gBADP,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,GAAG,YAAY;IAWnC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,IAAI,CAAc;IAE1B,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY;IAW/C,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,eAAe;CAKzB;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B;;;;OAIG;gBAED,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,YAAY;IAMnC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,KAAK,CAAkB;IAE/B;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC;IAI1E,QAAQ,IAAI,MAAM;CAGnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,MAAM,CA6CR"}
|
package/dist/dsp/resamplers.js
CHANGED
|
@@ -12,87 +12,399 @@
|
|
|
12
12
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
|
+
import { RadioError, RadioErrorType } from "../errors.js";
|
|
15
16
|
import { Float32Pool } from "./buffers.js";
|
|
16
17
|
import { makeLowPassKernel } from "./coefficients.js";
|
|
17
18
|
import { FIRFilter } from "./filters.js";
|
|
18
|
-
|
|
19
|
-
class Downsampler {
|
|
19
|
+
class PureRealDownsampler {
|
|
20
20
|
ratio;
|
|
21
|
-
|
|
22
|
-
* @param ratio The ratio of input/output sample rates.
|
|
23
|
-
* @param kernel The coefficients for the low-pass filter.
|
|
24
|
-
*/
|
|
25
|
-
constructor(ratio, filter) {
|
|
21
|
+
constructor(ratio, kernel) {
|
|
26
22
|
this.ratio = ratio;
|
|
27
|
-
|
|
23
|
+
if (ratio != Math.floor(ratio))
|
|
24
|
+
throw new RadioError(`Non-integer downsample ratio: ${ratio}`, RadioErrorType.DemodulationError);
|
|
25
|
+
this.filter = new FIRFilter(kernel);
|
|
28
26
|
this.pool = new Float32Pool(2);
|
|
27
|
+
this.residual = 0;
|
|
29
28
|
}
|
|
30
29
|
filter;
|
|
31
30
|
pool;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @param samples The sample block to downsample.
|
|
35
|
-
* @returns The downsampled block.
|
|
36
|
-
*/
|
|
37
|
-
downsample(samples) {
|
|
31
|
+
residual;
|
|
32
|
+
resample(samples) {
|
|
38
33
|
const ratio = this.ratio;
|
|
39
|
-
const
|
|
40
|
-
|
|
34
|
+
const skip = (ratio - this.residual) % ratio;
|
|
35
|
+
const outLen = Math.floor((this.residual + samples.length - 1) / ratio) -
|
|
36
|
+
Math.floor((this.residual - 1) / ratio);
|
|
37
|
+
let output = this.pool.get(outLen);
|
|
41
38
|
this.filter.loadSamples(samples);
|
|
42
|
-
for (let i = 0; i <
|
|
43
|
-
output[i] = this.filter.get(
|
|
39
|
+
for (let i = 0; i < outLen; ++i) {
|
|
40
|
+
output[i] = this.filter.get(skip + i * ratio);
|
|
44
41
|
}
|
|
42
|
+
this.residual = (this.residual + samples.length) % ratio;
|
|
45
43
|
return output;
|
|
46
44
|
}
|
|
47
45
|
getDelay() {
|
|
48
46
|
return this.filter.getDelay() / this.ratio;
|
|
49
47
|
}
|
|
50
48
|
clone() {
|
|
51
|
-
|
|
49
|
+
let out = new PureRealDownsampler(this.ratio, new Float32Array(1));
|
|
50
|
+
out.filter = this.filter.clone();
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class PureRealUpsampler {
|
|
55
|
+
ratio;
|
|
56
|
+
constructor(ratio, kernel) {
|
|
57
|
+
this.ratio = ratio;
|
|
58
|
+
if (ratio != Math.floor(ratio))
|
|
59
|
+
throw new RadioError(`Non-integer upsample ratio: ${ratio}`, RadioErrorType.DemodulationError);
|
|
60
|
+
this.filter = new Polyfilter(kernel, ratio);
|
|
61
|
+
this.pool = new Float32Pool(2);
|
|
62
|
+
}
|
|
63
|
+
filter;
|
|
64
|
+
pool;
|
|
65
|
+
resample(samples) {
|
|
66
|
+
const ratio = this.ratio;
|
|
67
|
+
const outLen = samples.length * ratio;
|
|
68
|
+
let output = this.pool.get(outLen);
|
|
69
|
+
this.filter.loadSamples(samples);
|
|
70
|
+
for (let i = 0, o = 0; i < samples.length; ++i) {
|
|
71
|
+
for (let j = 0; j < ratio; ++j, ++o) {
|
|
72
|
+
output[o] = this.filter.get(j, i);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return output;
|
|
76
|
+
}
|
|
77
|
+
getDelay() {
|
|
78
|
+
return this.filter.getDelay();
|
|
79
|
+
}
|
|
80
|
+
clone() {
|
|
81
|
+
let out = new PureRealUpsampler(this.ratio, new Float32Array(this.ratio));
|
|
82
|
+
out.filter = this.filter.clone();
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class RealUpDownsampler {
|
|
87
|
+
upRatio;
|
|
88
|
+
downRatio;
|
|
89
|
+
constructor(upRatio, downRatio, kernel) {
|
|
90
|
+
this.upRatio = upRatio;
|
|
91
|
+
this.downRatio = downRatio;
|
|
92
|
+
if (upRatio != Math.floor(upRatio))
|
|
93
|
+
throw new RadioError(`Non-integer upsample ratio: ${upRatio}`, RadioErrorType.DemodulationError);
|
|
94
|
+
if (downRatio != Math.floor(downRatio))
|
|
95
|
+
throw new RadioError(`Non-integer downsample ratio: ${downRatio}`, RadioErrorType.DemodulationError);
|
|
96
|
+
this.filter = new Polyfilter(kernel, upRatio);
|
|
97
|
+
this.pool = new Float32Pool(4);
|
|
98
|
+
this.residual = 0;
|
|
99
|
+
}
|
|
100
|
+
filter;
|
|
101
|
+
pool;
|
|
102
|
+
residual;
|
|
103
|
+
resample(samples) {
|
|
104
|
+
const upRatio = this.upRatio;
|
|
105
|
+
const midLen = samples.length * upRatio;
|
|
106
|
+
this.filter.loadSamples(samples);
|
|
107
|
+
const downRatio = this.downRatio;
|
|
108
|
+
const skip = (downRatio - this.residual) % downRatio;
|
|
109
|
+
const outLen = Math.floor((this.residual + midLen - 1) / downRatio) -
|
|
110
|
+
Math.floor((this.residual - 1) / downRatio);
|
|
111
|
+
let output = this.pool.get(outLen);
|
|
112
|
+
const di = Math.floor(downRatio / upRatio);
|
|
113
|
+
const dj = downRatio % upRatio;
|
|
114
|
+
let i = Math.floor(skip / upRatio);
|
|
115
|
+
let j = skip % upRatio;
|
|
116
|
+
for (let k = 0; k < outLen; ++k) {
|
|
117
|
+
output[k] = this.filter.get(j, i);
|
|
118
|
+
j += dj;
|
|
119
|
+
i += di;
|
|
120
|
+
if (j >= upRatio) {
|
|
121
|
+
j -= upRatio;
|
|
122
|
+
++i;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.residual = (this.residual + midLen) % downRatio;
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
getDelay() {
|
|
129
|
+
return this.filter.getDelay() / this.downRatio;
|
|
130
|
+
}
|
|
131
|
+
clone() {
|
|
132
|
+
let out = new RealUpDownsampler(this.upRatio, this.downRatio, new Float32Array(this.upRatio));
|
|
133
|
+
out.filter = this.filter.clone();
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class GenericIqResampler {
|
|
138
|
+
constructor(realResampler) {
|
|
139
|
+
this.resampleI = realResampler.clone();
|
|
140
|
+
this.resampleQ = realResampler.clone();
|
|
141
|
+
}
|
|
142
|
+
resampleI;
|
|
143
|
+
resampleQ;
|
|
144
|
+
resample(I, Q) {
|
|
145
|
+
return [this.resampleI.resample(I), this.resampleQ.resample(Q)];
|
|
146
|
+
}
|
|
147
|
+
getDelay() {
|
|
148
|
+
return this.resampleI.getDelay();
|
|
149
|
+
}
|
|
150
|
+
clone() {
|
|
151
|
+
return new GenericIqResampler(this.resampleI);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** Returns a RealResampler that converts signals from the input rate to the output rate. */
|
|
155
|
+
export function getRealResampler(inRate, outRate, options) {
|
|
156
|
+
if (inRate > outRate && inRate % outRate == 0) {
|
|
157
|
+
// Pure downsampler
|
|
158
|
+
let downFactor = inRate / outRate;
|
|
159
|
+
let corner = options?.lowPassFrequency || outRate / 2;
|
|
160
|
+
let taps = options?.taps || (options?.tapsPerLeg || 101) * downFactor;
|
|
161
|
+
let gain = options?.gain;
|
|
162
|
+
let kernel = options?.kernel || makeLowPassKernel(inRate, corner, taps, gain);
|
|
163
|
+
return new PureRealDownsampler(inRate / outRate, kernel);
|
|
164
|
+
}
|
|
165
|
+
if (inRate < outRate && outRate % inRate == 0) {
|
|
166
|
+
// Pure upsampler
|
|
167
|
+
let upFactor = outRate / inRate;
|
|
168
|
+
let corner = options?.lowPassFrequency || inRate / 2;
|
|
169
|
+
let taps = options?.taps || options?.tapsPerLeg || 101;
|
|
170
|
+
let gain = options?.gain;
|
|
171
|
+
let kernel = options?.kernel || makeLowPassKernel(outRate, corner, taps, gain);
|
|
172
|
+
return new PureRealUpsampler(upFactor, kernel);
|
|
52
173
|
}
|
|
174
|
+
// Resampler
|
|
175
|
+
let gcd = greatestCommonDivisor(inRate, outRate);
|
|
176
|
+
let upFactor = outRate / gcd;
|
|
177
|
+
let downFactor = inRate / gcd;
|
|
178
|
+
let interRate = (inRate * outRate) / gcd;
|
|
179
|
+
let corner = options?.lowPassFrequency || Math.min(inRate, outRate) / 2;
|
|
180
|
+
let taps = options?.taps || (options?.tapsPerLeg || 101) * downFactor;
|
|
181
|
+
let gain = options?.gain;
|
|
182
|
+
let kernel = options?.kernel || makeLowPassKernel(interRate, corner, taps, gain);
|
|
183
|
+
return new RealUpDownsampler(upFactor, downFactor, kernel);
|
|
53
184
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (typeof filter === "number")
|
|
58
|
-
filter = makeLowPassKernel(inRate, outRate / 2, filter);
|
|
59
|
-
return new Downsampler(ratio, new FIRFilter(filter));
|
|
185
|
+
/** Returns an IqResampler that converts signals from the input rate to the output rate. */
|
|
186
|
+
export function getIqResampler(inRate, outRate, options) {
|
|
187
|
+
return new GenericIqResampler(getRealResampler(inRate, outRate, options));
|
|
60
188
|
}
|
|
61
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* A class to convert the input to a lower sample rate.
|
|
191
|
+
* @deprecated Use getRealResampler() instead.
|
|
192
|
+
*/
|
|
62
193
|
export class RealDownsampler {
|
|
194
|
+
inRate;
|
|
195
|
+
outRate;
|
|
63
196
|
constructor(inRate, outRate, filterSpec) {
|
|
64
|
-
this.
|
|
197
|
+
this.inRate = inRate;
|
|
198
|
+
this.outRate = outRate;
|
|
199
|
+
this.ratio = inRate / outRate;
|
|
200
|
+
let kernel = typeof filterSpec === "number"
|
|
201
|
+
? makeLowPassKernel(inRate, outRate / 2, filterSpec)
|
|
202
|
+
: filterSpec;
|
|
203
|
+
this.filter = new FIRFilter(kernel);
|
|
204
|
+
this.pool = new Float32Pool(2);
|
|
65
205
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
206
|
+
ratio;
|
|
207
|
+
filter;
|
|
208
|
+
pool;
|
|
209
|
+
downsample(samples) {
|
|
210
|
+
const ratio = this.ratio;
|
|
211
|
+
const len = Math.floor(samples.length / ratio);
|
|
212
|
+
let output = this.pool.get(len);
|
|
213
|
+
this.filter.loadSamples(samples);
|
|
214
|
+
for (let i = 0; i < len; ++i) {
|
|
215
|
+
output[i] = this.filter.get(Math.floor(i * ratio));
|
|
216
|
+
}
|
|
217
|
+
return output;
|
|
73
218
|
}
|
|
74
219
|
getDelay() {
|
|
75
|
-
return this.
|
|
220
|
+
return this.filter.getDelay() / this.ratio;
|
|
221
|
+
}
|
|
222
|
+
clone() {
|
|
223
|
+
let out = new RealDownsampler(this.inRate, this.outRate, 1);
|
|
224
|
+
out.filter = this.filter.clone();
|
|
225
|
+
return out;
|
|
76
226
|
}
|
|
77
227
|
}
|
|
78
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* A class to convert a complex input to a lower sample rate.
|
|
230
|
+
* @deprecated Use getIqResampler() instead.
|
|
231
|
+
*/
|
|
79
232
|
export class ComplexDownsampler {
|
|
233
|
+
/**
|
|
234
|
+
* @param inRate The input sample rate.
|
|
235
|
+
* @param outRate The output sample rate.
|
|
236
|
+
* @param filterSpec The size or kernel of the low-pass filter to apply to the signal before downsampling.
|
|
237
|
+
*/
|
|
80
238
|
constructor(inRate, outRate, filterSpec) {
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
239
|
+
this.downI = new RealDownsampler(inRate, outRate, filterSpec);
|
|
240
|
+
this.downQ = this.downI.clone();
|
|
83
241
|
}
|
|
84
|
-
|
|
85
|
-
|
|
242
|
+
downI;
|
|
243
|
+
downQ;
|
|
86
244
|
/**
|
|
87
245
|
* @param I The signal's real component.
|
|
88
246
|
* @param Q The signal's imaginary component.
|
|
89
247
|
* @returns An array with the output's real and imaginary components.
|
|
90
248
|
*/
|
|
91
249
|
downsample(I, Q) {
|
|
92
|
-
return [this.
|
|
250
|
+
return [this.downI.downsample(I), this.downQ.downsample(Q)];
|
|
93
251
|
}
|
|
94
252
|
getDelay() {
|
|
95
|
-
return this.
|
|
253
|
+
return this.downI.getDelay();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Computes an output sample rate that makes for the simplest rescaler.
|
|
258
|
+
*
|
|
259
|
+
* For example, to resample 1024000 to 336000 samples/sec,
|
|
260
|
+
* the resampler has to upsample 21x and then downsample 64x.
|
|
261
|
+
* However, with a tolerance of 50000 samples/sec, you could instead
|
|
262
|
+
* resample to 384000 samples/sec, which only requires upsampling 3x and downsampling 8x.
|
|
263
|
+
*
|
|
264
|
+
* @param inRate The input sample rate.
|
|
265
|
+
* @param outRate The desired output sample rate.
|
|
266
|
+
* @param tolerance The variation that's allowed for the sample rate (over or under the outRate).
|
|
267
|
+
* @returns The computed sample rate.
|
|
268
|
+
*/
|
|
269
|
+
export function getGoodResampleRate(inRate, outRate, tolerance) {
|
|
270
|
+
if (inRate == outRate)
|
|
271
|
+
return inRate;
|
|
272
|
+
let left = outRate - tolerance;
|
|
273
|
+
let right = outRate + tolerance;
|
|
274
|
+
if (left <= inRate && inRate <= right)
|
|
275
|
+
return inRate;
|
|
276
|
+
if (inRate > outRate) {
|
|
277
|
+
for (let d = 2;; ++d) {
|
|
278
|
+
let best = -1;
|
|
279
|
+
let bestDist = outRate;
|
|
280
|
+
const minM = Math.ceil((left * d) / inRate);
|
|
281
|
+
const maxM = Math.floor((right * d) / inRate);
|
|
282
|
+
for (let m = minM; m <= maxM; ++m) {
|
|
283
|
+
let target = (inRate * m) / d;
|
|
284
|
+
if (Number.isInteger(target)) {
|
|
285
|
+
let dist = Math.abs(target - outRate);
|
|
286
|
+
if (dist < bestDist || best < 0) {
|
|
287
|
+
best = target;
|
|
288
|
+
bestDist = dist;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (best > 0)
|
|
293
|
+
return best;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
for (let m = 2;; ++m) {
|
|
297
|
+
let best = -1;
|
|
298
|
+
let bestDist = outRate;
|
|
299
|
+
const minD = Math.ceil((m * inRate) / right);
|
|
300
|
+
const maxD = Math.floor((m * inRate) / left);
|
|
301
|
+
for (let d = minD; d <= maxD; ++d) {
|
|
302
|
+
let target = (inRate * m) / d;
|
|
303
|
+
if (Number.isInteger(target)) {
|
|
304
|
+
let dist = Math.abs(target - outRate);
|
|
305
|
+
if (dist < bestDist || best < 0) {
|
|
306
|
+
best = target;
|
|
307
|
+
bestDist = dist;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (best > 0)
|
|
312
|
+
return best;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function greatestCommonDivisor(a, b) {
|
|
316
|
+
if (a < b) {
|
|
317
|
+
[a, b] = [b, a];
|
|
318
|
+
}
|
|
319
|
+
while (b != 0) {
|
|
320
|
+
[a, b] = [b, a % b];
|
|
321
|
+
}
|
|
322
|
+
return a;
|
|
323
|
+
}
|
|
324
|
+
/** A polyphase filter. */
|
|
325
|
+
class Polyfilter {
|
|
326
|
+
constructor(kernel, ratio) {
|
|
327
|
+
this.delay = Math.floor(kernel.length / 2);
|
|
328
|
+
if (kernel.length % ratio != 0) {
|
|
329
|
+
const wantedLen = ratio * Math.ceil(kernel.length / ratio);
|
|
330
|
+
const newKernel = new Float32Array(wantedLen);
|
|
331
|
+
newKernel.subarray(wantedLen - kernel.length, wantedLen).set(kernel);
|
|
332
|
+
kernel = newKernel;
|
|
333
|
+
}
|
|
334
|
+
const coefLen = kernel.length / ratio;
|
|
335
|
+
this.coefs = [];
|
|
336
|
+
for (let i = 0; i < ratio; ++i) {
|
|
337
|
+
const filterKernel = new Float32Array(coefLen);
|
|
338
|
+
for (let j = 0; j < filterKernel.length; ++j) {
|
|
339
|
+
filterKernel[j] = kernel[(j + 1) * ratio - i - 1] * ratio;
|
|
340
|
+
}
|
|
341
|
+
this.coefs[i] = filterKernel;
|
|
342
|
+
}
|
|
343
|
+
this.offset = coefLen - 1;
|
|
344
|
+
this.pool = new Float32Pool(2, 2 * this.offset);
|
|
345
|
+
this.curSamples = this.pool.get(this.offset);
|
|
346
|
+
}
|
|
347
|
+
delay;
|
|
348
|
+
coefs;
|
|
349
|
+
offset;
|
|
350
|
+
pool;
|
|
351
|
+
curSamples;
|
|
352
|
+
clone() {
|
|
353
|
+
let out = new Polyfilter(new Float32Array(this.coefs.length), this.coefs.length);
|
|
354
|
+
out.delay = this.delay;
|
|
355
|
+
out.coefs = this.coefs;
|
|
356
|
+
out.offset = this.offset;
|
|
357
|
+
return out;
|
|
358
|
+
}
|
|
359
|
+
getDelay() {
|
|
360
|
+
return this.delay;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Loads a new block of samples to filter.
|
|
364
|
+
* @param samples The samples to load.
|
|
365
|
+
*/
|
|
366
|
+
loadSamples(samples) {
|
|
367
|
+
const len = samples.length + this.offset;
|
|
368
|
+
if (this.curSamples.length != len) {
|
|
369
|
+
let newSamples = this.pool.get(len);
|
|
370
|
+
newSamples.set(this.curSamples.subarray(this.curSamples.length - this.offset));
|
|
371
|
+
this.curSamples = newSamples;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
this.curSamples.copyWithin(0, samples.length);
|
|
375
|
+
}
|
|
376
|
+
this.curSamples.set(samples, this.offset);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Returns a filtered sample.
|
|
380
|
+
* Be very careful when you modify this function. About 85% of the total execution
|
|
381
|
+
* time is spent here, so performance is critical.
|
|
382
|
+
* @param index The index of the sample to return, corresponding
|
|
383
|
+
* to the same index in the latest sample block loaded via loadSamples().
|
|
384
|
+
*/
|
|
385
|
+
get(phase, index) {
|
|
386
|
+
const coefs = this.coefs[phase];
|
|
387
|
+
let i = 0;
|
|
388
|
+
let out = 0;
|
|
389
|
+
let len = coefs.length;
|
|
390
|
+
let len4 = 4 * Math.floor(len / 4);
|
|
391
|
+
while (i < len4) {
|
|
392
|
+
out +=
|
|
393
|
+
coefs[i++] * this.curSamples[index++] +
|
|
394
|
+
coefs[i++] * this.curSamples[index++] +
|
|
395
|
+
coefs[i++] * this.curSamples[index++] +
|
|
396
|
+
coefs[i++] * this.curSamples[index++];
|
|
397
|
+
}
|
|
398
|
+
let len2 = 2 * Math.floor(len / 2);
|
|
399
|
+
while (i < len2) {
|
|
400
|
+
out +=
|
|
401
|
+
coefs[i++] * this.curSamples[index++] +
|
|
402
|
+
coefs[i++] * this.curSamples[index++];
|
|
403
|
+
}
|
|
404
|
+
while (i < len) {
|
|
405
|
+
out += coefs[i++] * this.curSamples[index++];
|
|
406
|
+
}
|
|
407
|
+
return out;
|
|
96
408
|
}
|
|
97
409
|
}
|
|
98
410
|
//# sourceMappingURL=resamplers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resamplers.js","sourceRoot":"","sources":["../../src/dsp/resamplers.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,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,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,8EAA8E;AAC9E,MAAM,WAAW;IAML;IALV;;;OAGG;IACH,YACU,KAAa,EACrB,MAAiB;QADT,UAAK,GAAL,KAAK,CAAQ;QAGrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAEO,MAAM,CAAY;IAClB,IAAI,CAAc;IAE1B;;;;OAIG;IACH,UAAU,CAAC,OAAqB;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAC/C,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,C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