@thi.ng/dsp 4.2.25 → 4.2.26
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 +1 -1
- package/agen.d.ts +3 -2
- package/agen.js +3 -2
- package/anti-alias.d.ts +8 -9
- package/anti-alias.js +8 -9
- package/aproc.d.ts +2 -1
- package/aproc.js +2 -1
- package/fft.d.ts +8 -7
- package/osc-additive.d.ts +2 -2
- package/osc-additive.js +2 -2
- package/osc.d.ts +2 -1
- package/osc.js +2 -1
- package/package.json +6 -6
- package/white-noise.d.ts +2 -1
- package/white-noise.js +2 -1
package/CHANGELOG.md
CHANGED
package/agen.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IGen } from "./api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Abstract base class for unit gens in this package. Provides
|
|
4
|
-
*
|
|
5
|
-
* `Iterable` implementations to use gens as ES6
|
|
4
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) to obtain
|
|
5
|
+
* the gen's current value and `Iterable` implementations to use gens as ES6
|
|
6
|
+
* iterables.
|
|
6
7
|
*/
|
|
7
8
|
export declare abstract class AGen<T> implements IGen<T> {
|
|
8
9
|
protected _val: T;
|
package/agen.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __take } from "./internal/take.js";
|
|
2
2
|
/**
|
|
3
3
|
* Abstract base class for unit gens in this package. Provides
|
|
4
|
-
*
|
|
5
|
-
* `Iterable` implementations to use gens as ES6
|
|
4
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) to obtain
|
|
5
|
+
* the gen's current value and `Iterable` implementations to use gens as ES6
|
|
6
|
+
* iterables.
|
|
6
7
|
*/
|
|
7
8
|
export class AGen {
|
|
8
9
|
constructor(_val) {
|
package/anti-alias.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { FnN2 } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
3
|
* Reference:
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
4
|
+
* - https://en.wikipedia.org/wiki/Gibbs_phenomenon
|
|
5
|
+
* - http://www.musicdsp.org/files/bandlimited.pdf
|
|
6
6
|
*
|
|
7
|
-
* Interactive graph
|
|
8
|
-
* {@link https://www.desmos.com/calculator/irugw6gnhy}
|
|
7
|
+
* [Interactive graph](https://www.desmos.com/calculator/irugw6gnhy)
|
|
9
8
|
*
|
|
10
9
|
* @param n - number of octaves
|
|
11
10
|
* @param i - curr octave [1..n]
|
|
@@ -15,9 +14,9 @@ export declare const gibbs: FnN2;
|
|
|
15
14
|
* Fejér weight for `k`-th harmonic in a Fourier series of length `n`.
|
|
16
15
|
*
|
|
17
16
|
* @remarks
|
|
18
|
-
* Used for attenuating the {@link gibbs} factor when summing a Fourier
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* Used for attenuating the {@link gibbs} factor when summing a Fourier series.
|
|
18
|
+
* Linearly attentuates higher harmonics, with the first bin receiving a weight
|
|
19
|
+
* on 1 and the last bin `1/n`.
|
|
21
20
|
*
|
|
22
21
|
* @param k -
|
|
23
22
|
* @param n -
|
|
@@ -26,8 +25,8 @@ export declare const fejer: FnN2;
|
|
|
26
25
|
/**
|
|
27
26
|
* Polynomial attenuation to create bandlimited version of a signal.
|
|
28
27
|
*
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
28
|
+
* - http://research.spa.aalto.fi/publications/papers/smc2010-phaseshaping/
|
|
29
|
+
* - http://www.kvraudio.com/forum/viewtopic.php?t=375517
|
|
31
30
|
*
|
|
32
31
|
* @param dt - time step
|
|
33
32
|
* @param t - normalized phase
|
package/anti-alias.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { HALF_PI } from "@thi.ng/math/api";
|
|
2
2
|
/**
|
|
3
3
|
* Reference:
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
4
|
+
* - https://en.wikipedia.org/wiki/Gibbs_phenomenon
|
|
5
|
+
* - http://www.musicdsp.org/files/bandlimited.pdf
|
|
6
6
|
*
|
|
7
|
-
* Interactive graph
|
|
8
|
-
* {@link https://www.desmos.com/calculator/irugw6gnhy}
|
|
7
|
+
* [Interactive graph](https://www.desmos.com/calculator/irugw6gnhy)
|
|
9
8
|
*
|
|
10
9
|
* @param n - number of octaves
|
|
11
10
|
* @param i - curr octave [1..n]
|
|
@@ -15,9 +14,9 @@ export const gibbs = (n, i) => Math.cos(((i - 1) * HALF_PI) / n) ** 2;
|
|
|
15
14
|
* Fejér weight for `k`-th harmonic in a Fourier series of length `n`.
|
|
16
15
|
*
|
|
17
16
|
* @remarks
|
|
18
|
-
* Used for attenuating the {@link gibbs} factor when summing a Fourier
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* Used for attenuating the {@link gibbs} factor when summing a Fourier series.
|
|
18
|
+
* Linearly attentuates higher harmonics, with the first bin receiving a weight
|
|
19
|
+
* on 1 and the last bin `1/n`.
|
|
21
20
|
*
|
|
22
21
|
* @param k -
|
|
23
22
|
* @param n -
|
|
@@ -26,8 +25,8 @@ export const fejer = (k, n) => (n - k) / n;
|
|
|
26
25
|
/**
|
|
27
26
|
* Polynomial attenuation to create bandlimited version of a signal.
|
|
28
27
|
*
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
28
|
+
* - http://research.spa.aalto.fi/publications/papers/smc2010-phaseshaping/
|
|
29
|
+
* - http://www.kvraudio.com/forum/viewtopic.php?t=375517
|
|
31
30
|
*
|
|
32
31
|
* @param dt - time step
|
|
33
32
|
* @param t - normalized phase
|
package/aproc.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { IXform } from "@thi.ng/transducers";
|
|
|
2
2
|
import type { IProc, IProc2 } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class for processors in this package. Provides
|
|
5
|
-
*
|
|
5
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) to obtain
|
|
6
|
+
* the processor's current value.
|
|
6
7
|
*/
|
|
7
8
|
export declare abstract class AProc<A, B> implements IProc<A, B>, IXform<A, B> {
|
|
8
9
|
protected _val: B;
|
package/aproc.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { map } from "@thi.ng/transducers/map";
|
|
2
2
|
/**
|
|
3
3
|
* Abstract base class for processors in this package. Provides
|
|
4
|
-
*
|
|
4
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html) to obtain
|
|
5
|
+
* the processor's current value.
|
|
5
6
|
*/
|
|
6
7
|
export class AProc {
|
|
7
8
|
constructor(_val) {
|
package/fft.d.ts
CHANGED
|
@@ -13,17 +13,18 @@ export declare const complexArray: (n: number) => ComplexArray;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const copyComplex: (complex: ComplexArray) => ComplexArray;
|
|
15
15
|
/**
|
|
16
|
-
* If given a {@link ComplexArray}, computes the complex conjugate,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* If given a {@link ComplexArray}, computes the complex conjugate, concatenates
|
|
17
|
+
* it in mirrored order to input (excluding bin 0) and returns it as new
|
|
18
|
+
* (complex) array.
|
|
19
19
|
*
|
|
20
20
|
* @remarks
|
|
21
21
|
* The length of the input buffer(s) is assumed to be a power of 2.
|
|
22
22
|
*
|
|
23
|
-
* If given a
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* If given a
|
|
24
|
+
* [`NumericArray`](https://docs.thi.ng/umbrella/api/types/NumericArray.html),
|
|
25
|
+
* the `isImg` arg chooses from one of the following operations: If `true`
|
|
26
|
+
* (default), returns new array with *negated* values concatenated in reverse
|
|
27
|
+
* order. If `false`, returns new array with *original* values concatenated in
|
|
27
28
|
* reverse order.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
package/osc-additive.d.ts
CHANGED
|
@@ -17,14 +17,14 @@ import type { StatelessOscillator } from "./api.js";
|
|
|
17
17
|
export declare const additive: (osc: StatelessOscillator, freqFn: Fn<number, number>, ampFn: Fn<number, number>, n: number) => StatelessOscillator;
|
|
18
18
|
/**
|
|
19
19
|
* Interactive graph of this oscillator:
|
|
20
|
-
*
|
|
20
|
+
* https://www.desmos.com/calculator/irugw6gnhy
|
|
21
21
|
*
|
|
22
22
|
* @param n - number of octaves
|
|
23
23
|
*/
|
|
24
24
|
export declare const squareAdditive: (n?: number) => StatelessOscillator;
|
|
25
25
|
/**
|
|
26
26
|
* Interactive graph of this oscillator:
|
|
27
|
-
*
|
|
27
|
+
* https://www.desmos.com/calculator/irugw6gnhy
|
|
28
28
|
*
|
|
29
29
|
* @param n - number of octaves
|
|
30
30
|
*/
|
package/osc-additive.js
CHANGED
|
@@ -31,14 +31,14 @@ export const additive = (osc, freqFn, ampFn, n) => {
|
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Interactive graph of this oscillator:
|
|
34
|
-
*
|
|
34
|
+
* https://www.desmos.com/calculator/irugw6gnhy
|
|
35
35
|
*
|
|
36
36
|
* @param n - number of octaves
|
|
37
37
|
*/
|
|
38
38
|
export const squareAdditive = (n = 8) => additive(sin, (i) => 2 * (i - 1) + 1, (i) => (1 / (2 * (i - 1) + 1)) * gibbs(n, i), n);
|
|
39
39
|
/**
|
|
40
40
|
* Interactive graph of this oscillator:
|
|
41
|
-
*
|
|
41
|
+
* https://www.desmos.com/calculator/irugw6gnhy
|
|
42
42
|
*
|
|
43
43
|
* @param n - number of octaves
|
|
44
44
|
*/
|
package/osc.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ import type { IGen, StatelessOscillator } from "./api.js";
|
|
|
13
13
|
* freq and its `dc` offset to `baseFreq * TAU`). Also see {@link fmodOsc} for
|
|
14
14
|
* syntax sugar. The `phase` arg is only used if `freq` is NOT an `IGen`.
|
|
15
15
|
*
|
|
16
|
-
* The oscillator initializes to zero and its
|
|
16
|
+
* The oscillator initializes to zero and its
|
|
17
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html).deref}
|
|
17
18
|
* value is only available / valid after the first invocation of
|
|
18
19
|
* {@link IGen.next}.
|
|
19
20
|
*
|
package/osc.js
CHANGED
|
@@ -16,7 +16,8 @@ import { sum } from "./sum.js";
|
|
|
16
16
|
* freq and its `dc` offset to `baseFreq * TAU`). Also see {@link fmodOsc} for
|
|
17
17
|
* syntax sugar. The `phase` arg is only used if `freq` is NOT an `IGen`.
|
|
18
18
|
*
|
|
19
|
-
* The oscillator initializes to zero and its
|
|
19
|
+
* The oscillator initializes to zero and its
|
|
20
|
+
* [`IDeref`](https://docs.thi.ng/umbrella/api/interfaces/IDeref.html).deref}
|
|
20
21
|
* value is only available / valid after the first invocation of
|
|
21
22
|
* {@link IGen.next}.
|
|
22
23
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/dsp",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.26",
|
|
4
4
|
"description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.6.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
38
|
"@thi.ng/checks": "^3.3.5",
|
|
39
39
|
"@thi.ng/errors": "^2.2.6",
|
|
40
|
-
"@thi.ng/math": "^5.3.
|
|
41
|
-
"@thi.ng/random": "^3.3.
|
|
42
|
-
"@thi.ng/transducers": "^8.3.
|
|
40
|
+
"@thi.ng/math": "^5.3.17",
|
|
41
|
+
"@thi.ng/random": "^3.3.19",
|
|
42
|
+
"@thi.ng/transducers": "^8.3.27"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "^7.33.7",
|
|
@@ -272,5 +272,5 @@
|
|
|
272
272
|
],
|
|
273
273
|
"year": 2015
|
|
274
274
|
},
|
|
275
|
-
"gitHead": "
|
|
275
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
276
276
|
}
|
package/white-noise.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { IRandom } from "@thi.ng/random";
|
|
|
3
3
|
import { AGen } from "./agen.js";
|
|
4
4
|
/**
|
|
5
5
|
* White noise gen with customizable gain and
|
|
6
|
-
*
|
|
6
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
7
|
+
* source.
|
|
7
8
|
*
|
|
8
9
|
* @param gain -
|
|
9
10
|
* @param rnd -
|
package/white-noise.js
CHANGED
|
@@ -2,7 +2,8 @@ import { SYSTEM } from "@thi.ng/random/system";
|
|
|
2
2
|
import { AGen } from "./agen.js";
|
|
3
3
|
/**
|
|
4
4
|
* White noise gen with customizable gain and
|
|
5
|
-
*
|
|
5
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
6
|
+
* source.
|
|
6
7
|
*
|
|
7
8
|
* @param gain -
|
|
8
9
|
* @param rnd -
|