@thi.ng/dsp 4.6.9 → 4.6.12

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-10-30T14:31:56Z
3
+ - **Last updated**: 2023-11-09T10:28:18Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -84,7 +84,7 @@ For Node.js REPL:
84
84
  const dsp = await import("@thi.ng/dsp");
85
85
  ```
86
86
 
87
- Package sizes (brotli'd, pre-treeshake): ESM: 7.30 KB
87
+ Package sizes (brotli'd, pre-treeshake): ESM: 7.74 KB
88
88
 
89
89
  ## Dependencies
90
90
 
package/add.js CHANGED
@@ -11,6 +11,9 @@ import { AGen } from "./agen.js";
11
11
  */
12
12
  export const add = (step, start, clamp) => new Add(step, start, clamp);
13
13
  export class Add extends AGen {
14
+ _step;
15
+ _start;
16
+ _clamp;
14
17
  constructor(_step = 1, _start = 0, _clamp) {
15
18
  super(0);
16
19
  this._step = _step;
package/adsr.js CHANGED
@@ -36,6 +36,16 @@ var EnvPhase;
36
36
  */
37
37
  export const adsr = (opts) => new ADSR(opts);
38
38
  export class ADSR extends AGen {
39
+ _phase;
40
+ _curve;
41
+ _atime;
42
+ _dtime;
43
+ _rtime;
44
+ _acurve;
45
+ _dcurve;
46
+ _sustain;
47
+ _speriod;
48
+ _gain;
39
49
  constructor(opts) {
40
50
  super(0);
41
51
  opts = {
package/agen.js CHANGED
@@ -6,6 +6,7 @@ import { __take } from "./internal/take.js";
6
6
  * iterables.
7
7
  */
8
8
  export class AGen {
9
+ _val;
9
10
  constructor(_val) {
10
11
  this._val = _val;
11
12
  }
package/allpass.js CHANGED
@@ -8,6 +8,9 @@ import { AProc } from "./aproc.js";
8
8
  */
9
9
  export const allpass = (freq) => new AllPass1(freq);
10
10
  export class AllPass1 extends AProc {
11
+ _freq;
12
+ _coeff;
13
+ _z1;
11
14
  constructor(freq) {
12
15
  super(0);
13
16
  this.setFreq(freq);
package/alt.js CHANGED
@@ -3,11 +3,13 @@ export const alt = (n = 1) => new Alt(n, -n);
3
3
  export const altT = (a, b) => new Alt(a, b);
4
4
  export const altB = (x = true) => new Alt(x, !x);
5
5
  export class Alt extends AGen {
6
+ _a;
7
+ _b;
8
+ _flip = true;
6
9
  constructor(_a, _b) {
7
10
  super(_b);
8
11
  this._a = _a;
9
12
  this._b = _b;
10
- this._flip = true;
11
13
  }
12
14
  copy() {
13
15
  return new Alt(this._a, this._b);
package/aproc.js CHANGED
@@ -5,6 +5,7 @@ import { map } from "@thi.ng/transducers/map";
5
5
  * the processor's current value.
6
6
  */
7
7
  export class AProc {
8
+ _val;
8
9
  constructor(_val) {
9
10
  this._val = _val;
10
11
  }
@@ -19,6 +20,7 @@ export class AProc {
19
20
  * Similar to {@link AProc}, but for processors with 2 inputs.
20
21
  */
21
22
  export class AProc2 {
23
+ _val;
22
24
  constructor(_val) {
23
25
  this._val = _val;
24
26
  }
package/biquad.js CHANGED
@@ -12,6 +12,17 @@ export const biquadPeak = (fc, q, gain = 6) => new Biquad("peak", fc, q, gain);
12
12
  export const biquadLoShelf = (fc, gain = -6) => new Biquad("loshelf", fc, undefined, gain);
13
13
  export const biquadHiShelf = (fc, gain = -6) => new Biquad("hishelf", fc, undefined, gain);
14
14
  export class Biquad extends AProc {
15
+ _type;
16
+ _freq;
17
+ _q;
18
+ _gain;
19
+ _a0;
20
+ _a1;
21
+ _a2;
22
+ _b1;
23
+ _b2;
24
+ _z1;
25
+ _z2;
15
26
  constructor(_type, _freq, _q = SQRT2_2, _gain = 0) {
16
27
  super(0);
17
28
  this._type = _type;
package/cosine.js CHANGED
@@ -9,6 +9,10 @@ import { AGen } from "./agen.js";
9
9
  */
10
10
  export const cosine = (freq, amp) => new Cosine(freq, amp);
11
11
  export class Cosine extends AGen {
12
+ _freq;
13
+ _amp;
14
+ _cos;
15
+ _nxt;
12
16
  constructor(_freq, _amp = 1) {
13
17
  super(0);
14
18
  this._freq = _freq;
package/delay.js CHANGED
@@ -19,6 +19,10 @@ export const delayT = (n, off) => new Delay(n, off);
19
19
  * at any delay time (within configured buffer size).
20
20
  */
21
21
  export class Delay extends AProc {
22
+ _empty;
23
+ _buf;
24
+ _rpos;
25
+ _wpos;
22
26
  /**
23
27
  * Constructs new delay line of size `n` and initializes all
24
28
  * elements to `empty`. If the latter is a function, the buffer will
package/feedback-delay.js CHANGED
@@ -12,6 +12,7 @@ import { Delay } from "./delay.js";
12
12
  */
13
13
  export const feedbackDelay = (n, feedback) => new FeedbackDelay(n, feedback);
14
14
  export class FeedbackDelay extends Delay {
15
+ _feedback;
15
16
  constructor(n, _feedback = 0.5) {
16
17
  super(n, 0);
17
18
  this._feedback = _feedback;
package/filter-delay.js CHANGED
@@ -10,6 +10,8 @@ import { Delay } from "./delay.js";
10
10
  */
11
11
  export const filterFeedbackDelay = (n, filter, feedback) => new FilterFeedbackDelay(n, filter, feedback);
12
12
  export class FilterFeedbackDelay extends Delay {
13
+ filter;
14
+ _feedback;
13
15
  constructor(n, filter, _feedback = 0.5) {
14
16
  super(n, 0);
15
17
  this.filter = filter;
package/foldback.js CHANGED
@@ -13,6 +13,8 @@ import { AProc } from "./aproc.js";
13
13
  */
14
14
  export const foldback = (thresh, amp) => new Foldback(thresh, amp);
15
15
  export class Foldback extends AProc {
16
+ _thresh;
17
+ _amp;
16
18
  constructor(_thresh = 1, _amp = 1 / _thresh) {
17
19
  super(0);
18
20
  this._thresh = _thresh;
package/impulse-train.js CHANGED
@@ -9,6 +9,11 @@ export const impulseTrain = (period, start) => new ImpulseTrain(1, 0, period, st
9
9
  export const impulseTrainT = (on, off, period, start) => new ImpulseTrain(on, off, period, start);
10
10
  export const impulseTrainB = (period, start) => new ImpulseTrain(true, false, period, start);
11
11
  export class ImpulseTrain extends AGen {
12
+ _on;
13
+ _off;
14
+ _period;
15
+ _pos;
16
+ _startpos;
12
17
  constructor(_on, _off, _period, _pos = 0) {
13
18
  super(_off);
14
19
  this._on = _on;
package/impulse.js CHANGED
@@ -22,6 +22,8 @@ export const impulseT = (on, off) => new Impulse(on, off);
22
22
  */
23
23
  export const impulseB = (start = true) => new Impulse(start, !start);
24
24
  export class Impulse extends AGen {
25
+ _on;
26
+ _off;
25
27
  constructor(_on, _off) {
26
28
  super(_on);
27
29
  this._on = _on;
package/integrator.js CHANGED
@@ -8,6 +8,8 @@ import { AProc } from "./aproc.js";
8
8
  */
9
9
  export const integrator = (coeff, start) => new Integrator(coeff, start);
10
10
  export class Integrator extends AProc {
11
+ _coeff;
12
+ _start;
11
13
  constructor(_coeff = 1, _start = 0) {
12
14
  super(_start);
13
15
  this._coeff = _coeff;
package/iterable.js CHANGED
@@ -15,6 +15,8 @@ import { __take } from "./internal/take.js";
15
15
  */
16
16
  export const iterable = (src, initial) => new $Iterable(src, initial);
17
17
  export class $Iterable {
18
+ _iter;
19
+ _val;
18
20
  constructor(src, initial) {
19
21
  this._iter = src[Symbol.iterator]();
20
22
  this._val = initial;
package/madd.js CHANGED
@@ -11,6 +11,10 @@ import { AGen } from "./agen.js";
11
11
  */
12
12
  export const madd = (factor, start, offset, clamp) => new MAdd(factor, start, offset, clamp);
13
13
  export class MAdd extends AGen {
14
+ _factor;
15
+ _start;
16
+ _offset;
17
+ _clamp;
14
18
  constructor(_factor = 1, _start = 1, _offset = 0, _clamp) {
15
19
  super(0);
16
20
  this._factor = _factor;
package/mapg.js CHANGED
@@ -15,6 +15,8 @@ export function mapG(op, ...args) {
15
15
  }
16
16
  }
17
17
  export class MapG1 extends AGen {
18
+ _op;
19
+ _a;
18
20
  constructor(_op, _a, init) {
19
21
  super(init);
20
22
  this._op = _op;
@@ -25,6 +27,9 @@ export class MapG1 extends AGen {
25
27
  }
26
28
  }
27
29
  export class MapG2 extends AGen {
30
+ _op;
31
+ _a;
32
+ _b;
28
33
  constructor(_op, _a, _b, init) {
29
34
  super(init);
30
35
  this._op = _op;
@@ -36,6 +41,10 @@ export class MapG2 extends AGen {
36
41
  }
37
42
  }
38
43
  export class MapG3 extends AGen {
44
+ _op;
45
+ _a;
46
+ _b;
47
+ _c;
39
48
  constructor(_op, _a, _b, _c, init) {
40
49
  super(init);
41
50
  this._op = _op;
@@ -48,6 +57,11 @@ export class MapG3 extends AGen {
48
57
  }
49
58
  }
50
59
  export class MapG4 extends AGen {
60
+ _op;
61
+ _a;
62
+ _b;
63
+ _c;
64
+ _d;
51
65
  constructor(_op, _a, _b, _c, _d, init) {
52
66
  super(init);
53
67
  this._op = _op;
package/merge.js CHANGED
@@ -9,6 +9,7 @@ import {} from "./api.js";
9
9
  export const merge = (...channels) => new Merge(channels, 0);
10
10
  export const mergeT = (channels, init) => new Merge(channels, init);
11
11
  export class Merge extends AGen {
12
+ _channels;
12
13
  constructor(_channels, init) {
13
14
  super(new Array(_channels.length).fill(init));
14
15
  this._channels = _channels;
package/mix.js CHANGED
@@ -3,6 +3,7 @@ import { AProc2 } from "./aproc.js";
3
3
  import { __ensureGenN } from "./internal/ensure.js";
4
4
  export const mix = (t) => new Mix(t);
5
5
  export class Mix extends AProc2 {
6
+ _t;
6
7
  constructor(t = 0.5) {
7
8
  super(0);
8
9
  this.mix = t;
package/mul.js CHANGED
@@ -11,6 +11,9 @@ import { AGen } from "./agen.js";
11
11
  */
12
12
  export const mul = (factor, start, clamp) => new Mul(factor, start, clamp);
13
13
  export class Mul extends AGen {
14
+ _factor;
15
+ _start;
16
+ _clamp;
14
17
  constructor(_factor = 1, _start = 1, _clamp) {
15
18
  super(0);
16
19
  this._factor = _factor;
package/multiplex.js CHANGED
@@ -3,6 +3,7 @@ export function multiplex(...procs) {
3
3
  return new Multiplex(procs);
4
4
  }
5
5
  export class Multiplex extends AProc {
6
+ _procs;
6
7
  constructor(procs) {
7
8
  super(procs.map((p) => p.deref()));
8
9
  this._procs = procs;
package/onepole.js CHANGED
@@ -7,6 +7,10 @@ export const onepoleHP = (fc) => new OnePole("hp", fc);
7
7
  * https://www.earlevel.com/main/2012/12/15/a-one-pole-filter/
8
8
  */
9
9
  export class OnePole extends AProc {
10
+ _type;
11
+ _freq;
12
+ _a0;
13
+ _b1;
10
14
  constructor(_type, _freq) {
11
15
  super(0);
12
16
  this._type = _type;
package/osc.js CHANGED
@@ -57,6 +57,10 @@ export const osc = (osc, freq, amp, dc, phase) => new Osc(osc, freq, amp, dc, ph
57
57
  */
58
58
  export const modOsc = (osc, freq, fmod, amod = 1, dc, phase) => new Osc(osc, sum(isNumber(fmod) ? new Const(fmod) : fmod, isNumber(freq) ? add(freq) : freq), amod, dc, phase);
59
59
  export class Osc extends AGen {
60
+ _osc;
61
+ _dc;
62
+ _phase;
63
+ _amp;
60
64
  constructor(_osc, freq, amp = 1, _dc = 0, phase = 0) {
61
65
  super(0);
62
66
  this._osc = _osc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/dsp",
3
- "version": "4.6.9",
3
+ "version": "4.6.12",
4
4
  "description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -28,25 +28,24 @@
28
28
  "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc internal",
29
29
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && tools:readme",
32
- "doc:stats": "tools:module-stats",
31
+ "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
33
32
  "pub": "yarn npm publish --access public",
34
- "test": "testament test"
33
+ "test": "bun test"
35
34
  },
36
35
  "dependencies": {
37
- "@thi.ng/api": "^8.9.6",
38
- "@thi.ng/checks": "^3.4.6",
39
- "@thi.ng/errors": "^2.4.0",
40
- "@thi.ng/math": "^5.7.1",
41
- "@thi.ng/random": "^3.6.11",
42
- "@thi.ng/transducers": "^8.8.7"
36
+ "@thi.ng/api": "^8.9.8",
37
+ "@thi.ng/checks": "^3.4.8",
38
+ "@thi.ng/errors": "^2.4.2",
39
+ "@thi.ng/math": "^5.7.3",
40
+ "@thi.ng/random": "^3.6.14",
41
+ "@thi.ng/transducers": "^8.8.10"
43
42
  },
44
43
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.38.0",
46
- "@thi.ng/testament": "^0.3.24",
44
+ "@microsoft/api-extractor": "^7.38.2",
45
+ "@thi.ng/testament": "^0.4.1",
47
46
  "rimraf": "^5.0.5",
48
47
  "tools": "^0.0.1",
49
- "typedoc": "^0.25.2",
48
+ "typedoc": "^0.25.3",
50
49
  "typescript": "^5.2.2"
51
50
  },
52
51
  "keywords": [
@@ -284,5 +283,5 @@
284
283
  ],
285
284
  "year": 2015
286
285
  },
287
- "gitHead": "bfa16829786146bd24df3cdbd44649a45a603e44\n"
286
+ "gitHead": "669a3151e4302480244fe3e60eff5e732ea5b7a7\n"
288
287
  }
package/pan.js CHANGED
@@ -14,6 +14,7 @@ import { __ensureGenN } from "./internal/ensure.js";
14
14
  */
15
15
  export const pan = (pos) => new Pan(pos);
16
16
  export class Pan extends AProc {
17
+ _pos;
17
18
  constructor(pos = 0) {
18
19
  super([0, 0]);
19
20
  this.pos = pos;
package/pink-noise.js CHANGED
@@ -28,6 +28,11 @@ const PROB = [0.00198, 0.0128, 0.049, 0.17, 0.682];
28
28
  */
29
29
  export const pinkNoise = (gain, rnd, amp, prob) => new PinkNoise(gain, rnd, amp, prob);
30
30
  export class PinkNoise extends AGen {
31
+ _gain;
32
+ _rnd;
33
+ _amp;
34
+ _bins;
35
+ _psum;
31
36
  constructor(_gain = 1, _rnd = SYSTEM, _amp = AMP, prob = PROB) {
32
37
  super(0);
33
38
  this._gain = _gain;
package/reciprocal.js CHANGED
@@ -6,6 +6,8 @@ import { AGen } from "./agen.js";
6
6
  */
7
7
  export const reciprocal = (step) => new Reciprocal(step);
8
8
  export class Reciprocal extends AGen {
9
+ _step;
10
+ _n;
9
11
  constructor(_step = 1) {
10
12
  super(1);
11
13
  this._step = _step;
package/ref.js CHANGED
@@ -2,6 +2,7 @@ import { AGen } from "./agen.js";
2
2
  import { AProc } from "./aproc.js";
3
3
  export const refG = (src) => new RefG(src);
4
4
  export class RefG extends AGen {
5
+ _src;
5
6
  constructor(_src) {
6
7
  super(_src.deref());
7
8
  this._src = _src;
@@ -12,6 +13,7 @@ export class RefG extends AGen {
12
13
  }
13
14
  export const refP = (src) => new RefP(src);
14
15
  export class RefP extends AProc {
16
+ _src;
15
17
  constructor(_src) {
16
18
  super(_src.deref());
17
19
  this._src = _src;
package/serial.js CHANGED
@@ -13,6 +13,8 @@ export function serial(...procs) {
13
13
  }
14
14
  }
15
15
  export class Serial2 extends AProc {
16
+ _a;
17
+ _b;
16
18
  constructor(_a, _b) {
17
19
  super(null);
18
20
  this._a = _a;
@@ -23,6 +25,9 @@ export class Serial2 extends AProc {
23
25
  }
24
26
  }
25
27
  export class Serial3 extends AProc {
28
+ _a;
29
+ _b;
30
+ _c;
26
31
  constructor(_a, _b, _c) {
27
32
  super(null);
28
33
  this._a = _a;
@@ -34,6 +39,10 @@ export class Serial3 extends AProc {
34
39
  }
35
40
  }
36
41
  export class Serial4 extends AProc {
42
+ _a;
43
+ _b;
44
+ _c;
45
+ _d;
37
46
  constructor(_a, _b, _c, _d) {
38
47
  super(null);
39
48
  this._a = _a;
@@ -46,6 +55,7 @@ export class Serial4 extends AProc {
46
55
  }
47
56
  }
48
57
  export class Serial extends AProc {
58
+ _procs;
49
59
  constructor(_procs) {
50
60
  super(null);
51
61
  this._procs = _procs;
package/sincos.js CHANGED
@@ -18,6 +18,11 @@ import { AGen } from "./agen.js";
18
18
  * @param amp - amplitude (default: 1)
19
19
  */
20
20
  export class SinCos extends AGen {
21
+ _freq;
22
+ _amp;
23
+ _f;
24
+ _s;
25
+ _c;
21
26
  constructor(_freq, _amp = 1) {
22
27
  super([0, _amp]);
23
28
  this._freq = _freq;
package/svf.js CHANGED
@@ -17,6 +17,15 @@ export const svfAllpass = (fc, q) => new SVF("all", fc, q);
17
17
  * - https://en.wikipedia.org/wiki/Trapezoidal_rule
18
18
  */
19
19
  export class SVF extends AProc {
20
+ _type;
21
+ _freq;
22
+ _q;
23
+ _a1;
24
+ _a2;
25
+ _c1;
26
+ _c2;
27
+ _g;
28
+ _k;
20
29
  constructor(_type, _freq, _q = 0.5) {
21
30
  super(0);
22
31
  this._type = _type;
package/waveshaper.js CHANGED
@@ -26,6 +26,10 @@ import { AProc } from "./aproc.js";
26
26
  */
27
27
  export const waveShaper = (thresh, amp, map) => new WaveShaper(thresh, amp, map);
28
28
  export class WaveShaper extends AProc {
29
+ _coeff;
30
+ _map;
31
+ _amp;
32
+ _autoGain;
29
33
  constructor(_coeff = 3, amp = true, _map = waveshapeSigmoid) {
30
34
  super(0);
31
35
  this._coeff = _coeff;
package/white-noise.js CHANGED
@@ -10,6 +10,8 @@ import { AGen } from "./agen.js";
10
10
  */
11
11
  export const whiteNoise = (gain, rnd) => new WhiteNoise(gain, rnd);
12
12
  export class WhiteNoise extends AGen {
13
+ _gain;
14
+ _rnd;
13
15
  constructor(_gain = 1, _rnd = SYSTEM) {
14
16
  super(0);
15
17
  this._gain = _gain;