@thi.ng/dsp 3.0.28 → 4.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.
Files changed (129) hide show
  1. package/CHANGELOG.md +82 -133
  2. package/README.md +66 -58
  3. package/{gen/add.d.ts → add.d.ts} +4 -2
  4. package/{gen/add.js → add.js} +7 -2
  5. package/{comp/addg.d.ts → addg.d.ts} +1 -1
  6. package/{comp/addg.js → addg.js} +0 -0
  7. package/{gen/adsr.d.ts → adsr.d.ts} +1 -1
  8. package/{gen/adsr.js → adsr.js} +22 -2
  9. package/{gen/agen.d.ts → agen.d.ts} +1 -1
  10. package/{gen/agen.js → agen.js} +3 -4
  11. package/{proc/allpass.d.ts → allpass.d.ts} +0 -0
  12. package/{proc/allpass.js → allpass.js} +5 -1
  13. package/{gen/alt.d.ts → alt.d.ts} +0 -0
  14. package/{gen/alt.js → alt.js} +3 -1
  15. package/{util/anti-alias.d.ts → anti-alias.d.ts} +0 -0
  16. package/{util/anti-alias.js → anti-alias.js} +1 -1
  17. package/{proc/aproc.d.ts → aproc.d.ts} +6 -4
  18. package/{proc/aproc.js → aproc.js} +8 -4
  19. package/{proc/biquad.d.ts → biquad.d.ts} +1 -1
  20. package/{proc/biquad.js → biquad.js} +15 -3
  21. package/bounce.d.ts +13 -0
  22. package/bounce.js +18 -0
  23. package/{util/complex.d.ts → complex.d.ts} +1 -1
  24. package/{util/complex.js → complex.js} +1 -1
  25. package/{gen/const.d.ts → const.d.ts} +0 -0
  26. package/{gen/const.js → const.js} +0 -0
  27. package/{util/convert.d.ts → convert.d.ts} +0 -0
  28. package/{util/convert.js → convert.js} +1 -1
  29. package/{gen/cosine.d.ts → cosine.d.ts} +0 -0
  30. package/{gen/cosine.js → cosine.js} +5 -1
  31. package/{gen/curve.d.ts → curve.d.ts} +0 -0
  32. package/{gen/curve.js → curve.js} +0 -0
  33. package/{proc/dcblock.d.ts → dcblock.d.ts} +0 -0
  34. package/{proc/dcblock.js → dcblock.js} +0 -0
  35. package/{proc/delay.d.ts → delay.d.ts} +0 -0
  36. package/{proc/delay.js → delay.js} +6 -2
  37. package/{proc/feedback-delay.d.ts → feedback-delay.d.ts} +0 -0
  38. package/{proc/feedback-delay.js → feedback-delay.js} +2 -1
  39. package/{fft/fft.d.ts → fft.d.ts} +1 -1
  40. package/{fft/fft.js → fft.js} +2 -2
  41. package/{util/filter-response.d.ts → filter-response.d.ts} +1 -1
  42. package/{util/filter-response.js → filter-response.js} +3 -2
  43. package/{proc/foldback.d.ts → foldback.d.ts} +0 -0
  44. package/{proc/foldback.js → foldback.js} +3 -1
  45. package/{gen/impulse-train.d.ts → impulse-train.d.ts} +0 -0
  46. package/{gen/impulse-train.js → impulse-train.js} +5 -0
  47. package/{gen/impulse.d.ts → impulse.d.ts} +0 -0
  48. package/{gen/impulse.js → impulse.js} +2 -0
  49. package/index.d.ts +56 -55
  50. package/index.js +56 -55
  51. package/{proc/integrator.d.ts → integrator.d.ts} +0 -0
  52. package/{proc/integrator.js → integrator.js} +2 -0
  53. package/internal/take.d.ts +3 -0
  54. package/internal/take.js +6 -0
  55. package/{gen/iterable.d.ts → iterable.d.ts} +1 -1
  56. package/{gen/iterable.js → iterable.js} +4 -4
  57. package/{gen/line.d.ts → line.d.ts} +0 -0
  58. package/{gen/line.js → line.js} +0 -0
  59. package/{gen/madd.d.ts → madd.d.ts} +0 -0
  60. package/{gen/madd.js → madd.js} +4 -0
  61. package/{comp/mapg.d.ts → mapg.d.ts} +2 -2
  62. package/{comp/mapg.js → mapg.js} +16 -2
  63. package/{proc/mix.d.ts → mix.d.ts} +0 -0
  64. package/{proc/mix.js → mix.js} +2 -1
  65. package/{gen/mul.d.ts → mul.d.ts} +0 -0
  66. package/{gen/mul.js → mul.js} +3 -0
  67. package/multiplex.d.ts +26 -0
  68. package/{comp/multiplex.js → multiplex.js} +2 -1
  69. package/{proc/onepole.d.ts → onepole.d.ts} +1 -1
  70. package/{proc/onepole.js → onepole.js} +6 -1
  71. package/{osc/additive.d.ts → osc-additive.d.ts} +16 -2
  72. package/{osc/additive.js → osc-additive.js} +16 -2
  73. package/osc-cos.d.ts +3 -0
  74. package/{osc/cos.js → osc-cos.js} +1 -1
  75. package/{osc/dsf.d.ts → osc-dsf.d.ts} +2 -2
  76. package/{osc/dsf.js → osc-dsf.js} +1 -1
  77. package/{osc/mix.d.ts → osc-mix.d.ts} +2 -2
  78. package/{osc/mix.js → osc-mix.js} +1 -1
  79. package/{osc/parabolic.d.ts → osc-parabolic.d.ts} +2 -2
  80. package/{osc/parabolic.js → osc-parabolic.js} +1 -1
  81. package/{osc/rect.d.ts → osc-rect.d.ts} +2 -2
  82. package/{osc/rect.js → osc-rect.js} +1 -1
  83. package/osc-saw.d.ts +3 -0
  84. package/{osc/saw.js → osc-saw.js} +1 -1
  85. package/osc-sin.d.ts +3 -0
  86. package/{osc/sin.js → osc-sin.js} +1 -1
  87. package/osc-tri.d.ts +3 -0
  88. package/{osc/tri.js → osc-tri.js} +1 -1
  89. package/{osc/wavetable.d.ts → osc-wavetable.d.ts} +2 -2
  90. package/{osc/wavetable.js → osc-wavetable.js} +2 -1
  91. package/{gen/osc.d.ts → osc.d.ts} +1 -1
  92. package/{gen/osc.js → osc.js} +6 -2
  93. package/package.json +201 -33
  94. package/{gen/pink-noise.d.ts → pink-noise.d.ts} +1 -1
  95. package/{gen/pink-noise.js → pink-noise.js} +6 -1
  96. package/{comp/pipe.d.ts → pipe.d.ts} +8 -1
  97. package/{comp/pipe.js → pipe.js} +0 -0
  98. package/{fft/power.d.ts → power.d.ts} +1 -1
  99. package/{fft/power.js → power.js} +2 -2
  100. package/{comp/product.d.ts → product.d.ts} +1 -1
  101. package/{comp/product.js → product.js} +0 -0
  102. package/{gen/reciprocal.d.ts → reciprocal.d.ts} +0 -0
  103. package/{gen/reciprocal.js → reciprocal.js} +2 -0
  104. package/serial.d.ts +44 -0
  105. package/{comp/compp.js → serial.js} +20 -10
  106. package/{gen/sincos.d.ts → sincos.d.ts} +0 -0
  107. package/{gen/sincos.js → sincos.js} +6 -1
  108. package/{comp/sum.d.ts → sum.d.ts} +1 -1
  109. package/{comp/sum.js → sum.js} +0 -0
  110. package/{proc/svf.d.ts → svf.d.ts} +1 -1
  111. package/{proc/svf.js → svf.js} +11 -1
  112. package/{gen/sweep.d.ts → sweep.d.ts} +1 -1
  113. package/{gen/sweep.js → sweep.js} +1 -1
  114. package/{proc/waveshaper.d.ts → waveshaper.d.ts} +0 -0
  115. package/{proc/waveshaper.js → waveshaper.js} +5 -1
  116. package/{gen/white-noise.d.ts → white-noise.d.ts} +1 -1
  117. package/{gen/white-noise.js → white-noise.js} +3 -1
  118. package/{fft/window.d.ts → window.d.ts} +1 -1
  119. package/{fft/window.js → window.js} +2 -2
  120. package/comp/compp.d.ts +0 -33
  121. package/comp/multiplex.d.ts +0 -11
  122. package/lib/index.js +0 -1703
  123. package/lib/index.js.map +0 -1
  124. package/lib/index.umd.js +0 -1
  125. package/lib/index.umd.js.map +0 -1
  126. package/osc/cos.d.ts +0 -3
  127. package/osc/saw.d.ts +0 -3
  128. package/osc/sin.d.ts +0 -3
  129. package/osc/tri.d.ts +0 -3
File without changes
@@ -1,4 +1,5 @@
1
- import { clamp05, PI, QUARTER_PI } from "@thi.ng/math";
1
+ import { PI, QUARTER_PI } from "@thi.ng/math/api";
2
+ import { clamp05 } from "@thi.ng/math/interval";
2
3
  import { AProc } from "./aproc";
3
4
  /**
4
5
  * One-pole allpass filter.
@@ -7,6 +8,9 @@ import { AProc } from "./aproc";
7
8
  */
8
9
  export const allpass = (freq) => new AllPass1(freq);
9
10
  export class AllPass1 extends AProc {
11
+ _freq;
12
+ _coeff;
13
+ _z1;
10
14
  constructor(freq) {
11
15
  super(0);
12
16
  this.setFreq(freq);
File without changes
@@ -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
  reset() {
13
15
  this._flip = true;
File without changes
@@ -1,4 +1,4 @@
1
- import { HALF_PI } from "@thi.ng/math";
1
+ import { HALF_PI } from "@thi.ng/math/api";
2
2
  /**
3
3
  * Reference:
4
4
  * - {@link https://en.wikipedia.org/wiki/Gibbs_phenomenon}
@@ -1,9 +1,8 @@
1
1
  import type { IXform } from "@thi.ng/transducers";
2
- import type { IProc, IProc2 } from "../api";
2
+ import type { IProc, IProc2 } from "./api";
3
3
  /**
4
- * Abstract base class for unit gens in this package. Provides
5
- * {@link @thi.ng/api#IDeref} to obtain the gen's current value and
6
- * `Iterable` implementations to use gens as ES6 iterables.
4
+ * Abstract base class for processors in this package. Provides
5
+ * {@link @thi.ng/api#IDeref} to obtain the processor's current value.
7
6
  */
8
7
  export declare abstract class AProc<A, B> implements IProc<A, B>, IXform<A, B> {
9
8
  protected _val: B;
@@ -12,6 +11,9 @@ export declare abstract class AProc<A, B> implements IProc<A, B>, IXform<A, B> {
12
11
  abstract next(x: A): B;
13
12
  xform(): import("@thi.ng/transducers").Transducer<A, B>;
14
13
  }
14
+ /**
15
+ * Similar to {@link AProc}, but for processors with 2 inputs.
16
+ */
15
17
  export declare abstract class AProc2<A, B, C> implements IProc2<A, B, C> {
16
18
  protected _val: C;
17
19
  constructor(_val: C);
@@ -1,10 +1,10 @@
1
- import { map } from "@thi.ng/transducers";
1
+ import { map } from "@thi.ng/transducers/map";
2
2
  /**
3
- * Abstract base class for unit gens in this package. Provides
4
- * {@link @thi.ng/api#IDeref} to obtain the gen's current value and
5
- * `Iterable` implementations to use gens as ES6 iterables.
3
+ * Abstract base class for processors in this package. Provides
4
+ * {@link @thi.ng/api#IDeref} to obtain the processor's current value.
6
5
  */
7
6
  export class AProc {
7
+ _val;
8
8
  constructor(_val) {
9
9
  this._val = _val;
10
10
  }
@@ -15,7 +15,11 @@ export class AProc {
15
15
  return map((x) => this.next(x));
16
16
  }
17
17
  }
18
+ /**
19
+ * Similar to {@link AProc}, but for processors with 2 inputs.
20
+ */
18
21
  export class AProc2 {
22
+ _val;
19
23
  constructor(_val) {
20
24
  this._val = _val;
21
25
  }
@@ -1,5 +1,5 @@
1
1
  import type { IReset } from "@thi.ng/api";
2
- import type { BiquadType, FilterConfig, IFilter } from "../api";
2
+ import type { BiquadType, FilterConfig, IFilter } from "./api";
3
3
  import { AProc } from "./aproc";
4
4
  export declare const biquad: (type: BiquadType, fc: number, q?: number | undefined, gain?: number | undefined) => Biquad;
5
5
  export declare const biquadLP: (fc: number, q?: number | undefined) => Biquad;
@@ -1,7 +1,8 @@
1
- import { unsupported } from "@thi.ng/errors";
2
- import { clamp05, PI, SQRT2, SQRT2_2 } from "@thi.ng/math";
3
- import { dbMag } from "../util/convert";
1
+ import { unsupported } from "@thi.ng/errors/unsupported";
2
+ import { PI, SQRT2, SQRT2_2 } from "@thi.ng/math/api";
3
+ import { clamp05 } from "@thi.ng/math/interval";
4
4
  import { AProc } from "./aproc";
5
+ import { dbMag } from "./convert";
5
6
  export const biquad = (type, fc, q, gain) => new Biquad(type, fc, q, gain);
6
7
  export const biquadLP = (fc, q) => new Biquad("lp", fc, q);
7
8
  export const biquadHP = (fc, q) => new Biquad("hp", fc, q);
@@ -11,6 +12,17 @@ export const biquadPeak = (fc, q, gain = 6) => new Biquad("peak", fc, q, gain);
11
12
  export const biquadLoShelf = (fc, gain = -6) => new Biquad("loshelf", fc, undefined, gain);
12
13
  export const biquadHiShelf = (fc, gain = -6) => new Biquad("hishelf", fc, undefined, gain);
13
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;
14
26
  constructor(_type, _freq, _q = SQRT2_2, _gain = 0) {
15
27
  super(0);
16
28
  this._type = _type;
package/bounce.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { NumericArray } from "@thi.ng/api";
2
+ import { AProc } from "./aproc";
3
+ /**
4
+ * Returns a new {@link Bounce} processor, which receives a multi-track tuple
5
+ * input (e.g. as produced by {@link multiplex}) and yields its "bounced down"
6
+ * (aka summed), single channel output.
7
+ */
8
+ export declare const bounce: () => Bounce;
9
+ export declare class Bounce extends AProc<NumericArray, number> {
10
+ constructor();
11
+ next(src: NumericArray): number;
12
+ }
13
+ //# sourceMappingURL=bounce.d.ts.map
package/bounce.js ADDED
@@ -0,0 +1,18 @@
1
+ import { AProc } from "./aproc";
2
+ /**
3
+ * Returns a new {@link Bounce} processor, which receives a multi-track tuple
4
+ * input (e.g. as produced by {@link multiplex}) and yields its "bounced down"
5
+ * (aka summed), single channel output.
6
+ */
7
+ export const bounce = () => new Bounce();
8
+ export class Bounce extends AProc {
9
+ constructor() {
10
+ super(0);
11
+ }
12
+ next(src) {
13
+ let res = 0;
14
+ for (let i = src.length; i-- > 0;)
15
+ res += src[i];
16
+ return (this._val = res);
17
+ }
18
+ }
@@ -1,4 +1,4 @@
1
1
  import type { NumericArray } from "@thi.ng/api";
2
- import type { ComplexArray } from "../api";
2
+ import type { ComplexArray } from "./api";
3
3
  export declare const isComplex: (buf: NumericArray | ComplexArray) => buf is ComplexArray;
4
4
  //# sourceMappingURL=complex.d.ts.map
@@ -1,2 +1,2 @@
1
- import { isNumber } from "@thi.ng/checks";
1
+ import { isNumber } from "@thi.ng/checks/is-number";
2
2
  export const isComplex = (buf) => !isNumber(buf[0]);
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { TAU } from "@thi.ng/math";
1
+ import { TAU } from "@thi.ng/math/api";
2
2
  /**
3
3
  * Returns frequency `f` normalized to sample rate `fs`:
4
4
  * `fnorm = f / fs`
File without changes
@@ -1,4 +1,4 @@
1
- import { TAU } from "@thi.ng/math";
1
+ import { TAU } from "@thi.ng/math/api";
2
2
  import { AGen } from "./agen";
3
3
  /**
4
4
  * Approximated cosine generator using given normalized `freq` and `amp`
@@ -9,6 +9,10 @@ import { AGen } from "./agen";
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;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import { isFunction } from "@thi.ng/checks";
2
- import { wrap } from "@thi.ng/math";
1
+ import { isFunction } from "@thi.ng/checks/is-function";
2
+ import { wrap } from "@thi.ng/math/interval";
3
3
  import { AProc } from "./aproc";
4
4
  /**
5
5
  * Delay line of length `n` for numeric values.
@@ -18,6 +18,10 @@ export const delayT = (n, off) => new Delay(n, off);
18
18
  * at any delay time (within configured buffer size).
19
19
  */
20
20
  export class Delay extends AProc {
21
+ _empty;
22
+ _buf;
23
+ _rpos;
24
+ _wpos;
21
25
  /**
22
26
  * Constructs new delay line of size `n` and initializes all
23
27
  * elements to `empty`. If the latter is a function, the buffer will
@@ -1,4 +1,4 @@
1
- import { clamp01 } from "@thi.ng/math";
1
+ import { clamp01 } from "@thi.ng/math/interval";
2
2
  import { Delay } from "./delay";
3
3
  /**
4
4
  * Extension of {@link Delay} which adds sum delayed value multiplied
@@ -9,6 +9,7 @@ import { Delay } from "./delay";
9
9
  */
10
10
  export const feedbackDelay = (n, feedback) => new FeedbackDelay(n, feedback);
11
11
  export class FeedbackDelay extends Delay {
12
+ _feedback;
12
13
  constructor(n, _feedback = 0.5) {
13
14
  super(n, 0);
14
15
  this._feedback = _feedback;
@@ -1,5 +1,5 @@
1
1
  import type { FnN3, NumericArray } from "@thi.ng/api";
2
- import type { ComplexArray } from "../api";
2
+ import type { ComplexArray } from "./api";
3
3
  /**
4
4
  * Returns a new tuple of real/img F64 buffers of given size.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { isComplex } from "../util/complex";
2
- import { magDb } from "../util/convert";
1
+ import { isComplex } from "./complex";
2
+ import { magDb } from "./convert";
3
3
  import { invPowerScale, powerScale } from "./power";
4
4
  import { applyWindow } from "./window";
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import type { FnU3, NumericArray } from "@thi.ng/api";
2
- import type { FilterConfig, FilterResponse } from "../api";
2
+ import type { FilterConfig, FilterResponse } from "./api";
3
3
  /**
4
4
  * Returns filter response for given filter coefficients at normalized
5
5
  * frequency `f`. If `db` is true (default), the magnitude in the
@@ -1,6 +1,7 @@
1
- import { cossin, TAU } from "@thi.ng/math";
2
- import { line } from "../gen/line";
1
+ import { cossin } from "@thi.ng/math/angle";
2
+ import { TAU } from "@thi.ng/math/api";
3
3
  import { magDb } from "./convert";
4
+ import { line } from "./line";
4
5
  /**
5
6
  * Returns filter response for given filter coefficients at normalized
6
7
  * frequency `f`. If `db` is true (default), the magnitude in the
File without changes
@@ -1,4 +1,4 @@
1
- import { foldback as _foldback } from "@thi.ng/math";
1
+ import { foldback as _foldback } from "@thi.ng/math/interval";
2
2
  import { AProc } from "./aproc";
3
3
  /**
4
4
  * Recursively folds input into `[-thresh .. +thresh]` interval and
@@ -13,6 +13,8 @@ import { AProc } from "./aproc";
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;
File without changes
@@ -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;
File without changes
@@ -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/index.d.ts CHANGED
@@ -1,57 +1,58 @@
1
+ export * from "./add";
2
+ export * from "./addg";
3
+ export * from "./adsr";
4
+ export * from "./agen";
5
+ export * from "./allpass";
6
+ export * from "./alt";
7
+ export * from "./anti-alias";
1
8
  export * from "./api";
2
- export * from "./comp/addg";
3
- export * from "./comp/compp";
4
- export * from "./comp/mapg";
5
- export * from "./comp/multiplex";
6
- export * from "./comp/pipe";
7
- export * from "./comp/product";
8
- export * from "./comp/sum";
9
- export * from "./gen/add";
10
- export * from "./gen/adsr";
11
- export * from "./gen/agen";
12
- export * from "./gen/alt";
13
- export * from "./gen/const";
14
- export * from "./gen/cosine";
15
- export * from "./gen/curve";
16
- export * from "./gen/impulse";
17
- export * from "./gen/impulse-train";
18
- export * from "./gen/iterable";
19
- export * from "./gen/line";
20
- export * from "./gen/madd";
21
- export * from "./gen/mul";
22
- export * from "./gen/osc";
23
- export * from "./gen/pink-noise";
24
- export * from "./gen/reciprocal";
25
- export * from "./gen/sincos";
26
- export * from "./gen/sweep";
27
- export * from "./gen/white-noise";
28
- export * from "./proc/allpass";
29
- export * from "./proc/aproc";
30
- export * from "./proc/biquad";
31
- export * from "./proc/dcblock";
32
- export * from "./proc/delay";
33
- export * from "./proc/feedback-delay";
34
- export * from "./proc/foldback";
35
- export * from "./proc/integrator";
36
- export * from "./proc/mix";
37
- export * from "./proc/onepole";
38
- export * from "./proc/svf";
39
- export * from "./proc/waveshaper";
40
- export * from "./osc/additive";
41
- export * from "./osc/cos";
42
- export * from "./osc/dsf";
43
- export * from "./osc/mix";
44
- export * from "./osc/parabolic";
45
- export * from "./osc/rect";
46
- export * from "./osc/saw";
47
- export * from "./osc/sin";
48
- export * from "./osc/tri";
49
- export * from "./osc/wavetable";
50
- export * from "./fft/fft";
51
- export * from "./fft/power";
52
- export * from "./fft/window";
53
- export * from "./util/anti-alias";
54
- export * from "./util/complex";
55
- export * from "./util/convert";
56
- export * from "./util/filter-response";
9
+ export * from "./aproc";
10
+ export * from "./biquad";
11
+ export * from "./bounce";
12
+ export * from "./complex";
13
+ export * from "./const";
14
+ export * from "./convert";
15
+ export * from "./cosine";
16
+ export * from "./curve";
17
+ export * from "./dcblock";
18
+ export * from "./delay";
19
+ export * from "./feedback-delay";
20
+ export * from "./fft";
21
+ export * from "./filter-response";
22
+ export * from "./foldback";
23
+ export * from "./impulse-train";
24
+ export * from "./impulse";
25
+ export * from "./integrator";
26
+ export * from "./iterable";
27
+ export * from "./line";
28
+ export * from "./madd";
29
+ export * from "./mapg";
30
+ export * from "./mix";
31
+ export * from "./mul";
32
+ export * from "./multiplex";
33
+ export * from "./onepole";
34
+ export * from "./osc-additive";
35
+ export * from "./osc-cos";
36
+ export * from "./osc-dsf";
37
+ export * from "./osc-mix";
38
+ export * from "./osc-parabolic";
39
+ export * from "./osc-rect";
40
+ export * from "./osc-saw";
41
+ export * from "./osc-sin";
42
+ export * from "./osc-tri";
43
+ export * from "./osc-wavetable";
44
+ export * from "./osc";
45
+ export * from "./pink-noise";
46
+ export * from "./pipe";
47
+ export * from "./power";
48
+ export * from "./product";
49
+ export * from "./reciprocal";
50
+ export * from "./serial";
51
+ export * from "./sincos";
52
+ export * from "./sum";
53
+ export * from "./svf";
54
+ export * from "./sweep";
55
+ export * from "./waveshaper";
56
+ export * from "./white-noise";
57
+ export * from "./window";
57
58
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,56 +1,57 @@
1
+ export * from "./add";
2
+ export * from "./addg";
3
+ export * from "./adsr";
4
+ export * from "./agen";
5
+ export * from "./allpass";
6
+ export * from "./alt";
7
+ export * from "./anti-alias";
1
8
  export * from "./api";
2
- export * from "./comp/addg";
3
- export * from "./comp/compp";
4
- export * from "./comp/mapg";
5
- export * from "./comp/multiplex";
6
- export * from "./comp/pipe";
7
- export * from "./comp/product";
8
- export * from "./comp/sum";
9
- export * from "./gen/add";
10
- export * from "./gen/adsr";
11
- export * from "./gen/agen";
12
- export * from "./gen/alt";
13
- export * from "./gen/const";
14
- export * from "./gen/cosine";
15
- export * from "./gen/curve";
16
- export * from "./gen/impulse";
17
- export * from "./gen/impulse-train";
18
- export * from "./gen/iterable";
19
- export * from "./gen/line";
20
- export * from "./gen/madd";
21
- export * from "./gen/mul";
22
- export * from "./gen/osc";
23
- export * from "./gen/pink-noise";
24
- export * from "./gen/reciprocal";
25
- export * from "./gen/sincos";
26
- export * from "./gen/sweep";
27
- export * from "./gen/white-noise";
28
- export * from "./proc/allpass";
29
- export * from "./proc/aproc";
30
- export * from "./proc/biquad";
31
- export * from "./proc/dcblock";
32
- export * from "./proc/delay";
33
- export * from "./proc/feedback-delay";
34
- export * from "./proc/foldback";
35
- export * from "./proc/integrator";
36
- export * from "./proc/mix";
37
- export * from "./proc/onepole";
38
- export * from "./proc/svf";
39
- export * from "./proc/waveshaper";
40
- export * from "./osc/additive";
41
- export * from "./osc/cos";
42
- export * from "./osc/dsf";
43
- export * from "./osc/mix";
44
- export * from "./osc/parabolic";
45
- export * from "./osc/rect";
46
- export * from "./osc/saw";
47
- export * from "./osc/sin";
48
- export * from "./osc/tri";
49
- export * from "./osc/wavetable";
50
- export * from "./fft/fft";
51
- export * from "./fft/power";
52
- export * from "./fft/window";
53
- export * from "./util/anti-alias";
54
- export * from "./util/complex";
55
- export * from "./util/convert";
56
- export * from "./util/filter-response";
9
+ export * from "./aproc";
10
+ export * from "./biquad";
11
+ export * from "./bounce";
12
+ export * from "./complex";
13
+ export * from "./const";
14
+ export * from "./convert";
15
+ export * from "./cosine";
16
+ export * from "./curve";
17
+ export * from "./dcblock";
18
+ export * from "./delay";
19
+ export * from "./feedback-delay";
20
+ export * from "./fft";
21
+ export * from "./filter-response";
22
+ export * from "./foldback";
23
+ export * from "./impulse-train";
24
+ export * from "./impulse";
25
+ export * from "./integrator";
26
+ export * from "./iterable";
27
+ export * from "./line";
28
+ export * from "./madd";
29
+ export * from "./mapg";
30
+ export * from "./mix";
31
+ export * from "./mul";
32
+ export * from "./multiplex";
33
+ export * from "./onepole";
34
+ export * from "./osc-additive";
35
+ export * from "./osc-cos";
36
+ export * from "./osc-dsf";
37
+ export * from "./osc-mix";
38
+ export * from "./osc-parabolic";
39
+ export * from "./osc-rect";
40
+ export * from "./osc-saw";
41
+ export * from "./osc-sin";
42
+ export * from "./osc-tri";
43
+ export * from "./osc-wavetable";
44
+ export * from "./osc";
45
+ export * from "./pink-noise";
46
+ export * from "./pipe";
47
+ export * from "./power";
48
+ export * from "./product";
49
+ export * from "./reciprocal";
50
+ export * from "./serial";
51
+ export * from "./sincos";
52
+ export * from "./sum";
53
+ export * from "./svf";
54
+ export * from "./sweep";
55
+ export * from "./waveshaper";
56
+ export * from "./white-noise";
57
+ export * from "./window";
File without changes
@@ -8,6 +8,8 @@ import { AProc } from "./aproc";
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;
@@ -0,0 +1,3 @@
1
+ import type { IGen } from "../api";
2
+ export declare const __take: <T>(src: IGen<T>, num: number, out?: T[], idx?: number) => T[];
3
+ //# sourceMappingURL=take.d.ts.map
@@ -0,0 +1,6 @@
1
+ export const __take = (src, num, out = [], idx = 0) => {
2
+ for (; --num >= 0;) {
3
+ out[idx++] = src.next();
4
+ }
5
+ return out;
6
+ };
@@ -1,4 +1,4 @@
1
- import type { IGen } from "../api";
1
+ import type { IGen } from "./api";
2
2
  /**
3
3
  * Wraps given ES6 iterable to provide full {@link IGen} implementation.
4
4
  *
@@ -1,3 +1,4 @@
1
+ import { __take } from "./internal/take";
1
2
  /**
2
3
  * Wraps given ES6 iterable to provide full {@link IGen} implementation.
3
4
  *
@@ -14,6 +15,8 @@
14
15
  */
15
16
  export const iterable = (src, initial) => new $Iterable(src, initial);
16
17
  export class $Iterable {
18
+ _iter;
19
+ _val;
17
20
  constructor(src, initial) {
18
21
  this._iter = src[Symbol.iterator]();
19
22
  this._val = initial;
@@ -38,9 +41,6 @@ export class $Iterable {
38
41
  return this._val;
39
42
  }
40
43
  take(num, out = [], idx = 0) {
41
- for (; --num >= 0;) {
42
- out[idx++] = this.next();
43
- }
44
- return out;
44
+ return __take(this, num, out, idx);
45
45
  }
46
46
  }
File without changes