@thi.ng/dsp 4.4.3 → 4.5.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/CHANGELOG.md +8 -1
- package/README.md +11 -10
- package/anti-alias.d.ts +1 -1
- package/anti-alias.js +1 -1
- package/osc-additive.d.ts +16 -4
- package/osc-additive.js +16 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-09-15T12:33:37Z
|
|
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.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [4.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dsp@4.5.0) (2023-09-15)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update saw/squareAdditive() ([d11488c](https://github.com/thi-ng/umbrella/commit/d11488c))
|
|
17
|
+
- add opt arg to disable Gibbs-effect handling
|
|
18
|
+
|
|
12
19
|
## [4.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/dsp@4.4.0) (2023-08-24)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
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: 6.
|
|
87
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 6.92 KB
|
|
88
88
|
|
|
89
89
|
## Dependencies
|
|
90
90
|
|
|
@@ -103,15 +103,16 @@ directory are using this package.
|
|
|
103
103
|
|
|
104
104
|
A selection:
|
|
105
105
|
|
|
106
|
-
| Screenshot | Description
|
|
107
|
-
|
|
108
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/> | Interactive inverse FFT toy synth
|
|
109
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/> | Fiber-based cooperative multitasking basics
|
|
110
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/> | Polygon to cubic curve conversion & visualization
|
|
111
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rasterize-blend.jpg" width="240"/> | Steering behavior drawing with alpha-blended shapes
|
|
112
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-canvas-basics.jpg" width="240"/> | Minimal rdom-canvas animation
|
|
113
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
114
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-
|
|
106
|
+
| Screenshot | Description | Live demo | Source |
|
|
107
|
+
|:--------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------|:---------------------------------------------------------|:--------------------------------------------------------------------------------------|
|
|
108
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/> | Interactive inverse FFT toy synth | [Demo](https://demo.thi.ng/umbrella/fft-synth/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fft-synth) |
|
|
109
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/> | Fiber-based cooperative multitasking basics | [Demo](https://demo.thi.ng/umbrella/fiber-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fiber-basics) |
|
|
110
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/> | Polygon to cubic curve conversion & visualization | [Demo](https://demo.thi.ng/umbrella/poly-spline/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-spline) |
|
|
111
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rasterize-blend.jpg" width="240"/> | Steering behavior drawing with alpha-blended shapes | [Demo](https://demo.thi.ng/umbrella/rasterize-blend/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rasterize-blend) |
|
|
112
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-canvas-basics.jpg" width="240"/> | Minimal rdom-canvas animation | [Demo](https://demo.thi.ng/umbrella/rdom-canvas-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-canvas-basics) |
|
|
113
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/render-audio.png" width="240"/> | Generative audio synth offline renderer and WAV file export | [Demo](https://demo.thi.ng/umbrella/render-audio/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/render-audio) |
|
|
114
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-cubemap.jpg" width="240"/> | WebGL cube maps with async texture loading | [Demo](https://demo.thi.ng/umbrella/webgl-cubemap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-cubemap) |
|
|
115
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-ssao.jpg" width="240"/> | WebGL screenspace ambient occlusion | [Demo](https://demo.thi.ng/umbrella/webgl-ssao/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/webgl-ssao) |
|
|
115
116
|
|
|
116
117
|
## API
|
|
117
118
|
|
package/anti-alias.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FnN2 } from "@thi.ng/api";
|
|
|
2
2
|
/**
|
|
3
3
|
* Reference:
|
|
4
4
|
* - https://en.wikipedia.org/wiki/Gibbs_phenomenon
|
|
5
|
-
* - http://www.musicdsp.org/files/bandlimited.pdf
|
|
5
|
+
* - https://web.archive.org/web/20031210115616/http://www.musicdsp.org/files/bandlimited.pdf
|
|
6
6
|
*
|
|
7
7
|
* [Interactive graph](https://www.desmos.com/calculator/irugw6gnhy)
|
|
8
8
|
*
|
package/anti-alias.js
CHANGED
|
@@ -2,7 +2,7 @@ import { HALF_PI } from "@thi.ng/math/api";
|
|
|
2
2
|
/**
|
|
3
3
|
* Reference:
|
|
4
4
|
* - https://en.wikipedia.org/wiki/Gibbs_phenomenon
|
|
5
|
-
* - http://www.musicdsp.org/files/bandlimited.pdf
|
|
5
|
+
* - https://web.archive.org/web/20031210115616/http://www.musicdsp.org/files/bandlimited.pdf
|
|
6
6
|
*
|
|
7
7
|
* [Interactive graph](https://www.desmos.com/calculator/irugw6gnhy)
|
|
8
8
|
*
|
package/osc-additive.d.ts
CHANGED
|
@@ -16,17 +16,29 @@ import type { StatelessOscillator } from "./api.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const additive: (osc: StatelessOscillator, freqFn: Fn<number, number>, ampFn: Fn<number, number>, n: number) => StatelessOscillator;
|
|
18
18
|
/**
|
|
19
|
+
* Returns a {@link StatelessOscillator} which constructs a square waveform from
|
|
20
|
+
* `n` partials. If `useGibbs` is true (default), also applies {@link gibbs} to
|
|
21
|
+
* each partial.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
19
24
|
* Interactive graph of this oscillator:
|
|
20
25
|
* https://www.desmos.com/calculator/irugw6gnhy
|
|
21
26
|
*
|
|
22
|
-
* @param n - number of
|
|
27
|
+
* @param n - number of partials
|
|
28
|
+
* @param useGibbs -
|
|
23
29
|
*/
|
|
24
|
-
export declare const squareAdditive: (n?: number) => StatelessOscillator;
|
|
30
|
+
export declare const squareAdditive: (n?: number, useGibbs?: boolean) => StatelessOscillator;
|
|
25
31
|
/**
|
|
32
|
+
* Returns a {@link StatelessOscillator} which constructs a sawtooth waveform
|
|
33
|
+
* from `n` partials. If `useGibbs` is true (default), also applies
|
|
34
|
+
* {@link gibbs} to each partial.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
26
37
|
* Interactive graph of this oscillator:
|
|
27
38
|
* https://www.desmos.com/calculator/irugw6gnhy
|
|
28
39
|
*
|
|
29
|
-
* @param n - number of
|
|
40
|
+
* @param n - number of partials
|
|
41
|
+
* @param useGibbs -
|
|
30
42
|
*/
|
|
31
|
-
export declare const sawAdditive: (n?: number) => StatelessOscillator;
|
|
43
|
+
export declare const sawAdditive: (n?: number, useGibbs?: boolean) => StatelessOscillator;
|
|
32
44
|
//# sourceMappingURL=osc-additive.d.ts.map
|
package/osc-additive.js
CHANGED
|
@@ -31,16 +31,28 @@ export const additive = (osc, freqFn, ampFn, n) => {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
+
* Returns a {@link StatelessOscillator} which constructs a square waveform from
|
|
35
|
+
* `n` partials. If `useGibbs` is true (default), also applies {@link gibbs} to
|
|
36
|
+
* each partial.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
34
39
|
* Interactive graph of this oscillator:
|
|
35
40
|
* https://www.desmos.com/calculator/irugw6gnhy
|
|
36
41
|
*
|
|
37
|
-
* @param n - number of
|
|
42
|
+
* @param n - number of partials
|
|
43
|
+
* @param useGibbs -
|
|
38
44
|
*/
|
|
39
|
-
export const squareAdditive = (n = 8) => additive(sin, (i) => 2 * (i - 1) + 1, (i) => (1 / (2 * (i - 1) + 1)) * gibbs(n, i), n);
|
|
45
|
+
export const squareAdditive = (n = 8, useGibbs = true) => additive(sin, (i) => 2 * (i - 1) + 1, (i) => (1 / (2 * (i - 1) + 1)) * (useGibbs ? gibbs(n, i) : 1), n);
|
|
40
46
|
/**
|
|
47
|
+
* Returns a {@link StatelessOscillator} which constructs a sawtooth waveform
|
|
48
|
+
* from `n` partials. If `useGibbs` is true (default), also applies
|
|
49
|
+
* {@link gibbs} to each partial.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
41
52
|
* Interactive graph of this oscillator:
|
|
42
53
|
* https://www.desmos.com/calculator/irugw6gnhy
|
|
43
54
|
*
|
|
44
|
-
* @param n - number of
|
|
55
|
+
* @param n - number of partials
|
|
56
|
+
* @param useGibbs -
|
|
45
57
|
*/
|
|
46
|
-
export const sawAdditive = (n = 8) => additive(sin, identity, (i) => (1 / i) * gibbs(n, i), n);
|
|
58
|
+
export const sawAdditive = (n = 8, useGibbs = true) => additive(sin, identity, (i) => (1 / i) * (useGibbs ? gibbs(n, i) : 1), n);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/dsp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@thi.ng/errors": "^2.3.5",
|
|
40
40
|
"@thi.ng/math": "^5.6.1",
|
|
41
41
|
"@thi.ng/random": "^3.6.4",
|
|
42
|
-
"@thi.ng/transducers": "^8.
|
|
42
|
+
"@thi.ng/transducers": "^8.7.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "^7.36.4",
|
|
@@ -275,5 +275,5 @@
|
|
|
275
275
|
],
|
|
276
276
|
"year": 2015
|
|
277
277
|
},
|
|
278
|
-
"gitHead": "
|
|
278
|
+
"gitHead": "b2ef5a1b8932d067af4ec2fc7da03d59d6868dc7\n"
|
|
279
279
|
}
|