@thi.ng/dsp 4.4.4 → 4.5.1

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-09-06T13:36:28Z
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.93 KB
87
+ Package sizes (brotli'd, pre-treeshake): ESM: 6.92 KB
88
88
 
89
89
  ## Dependencies
90
90
 
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 octaves
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 octaves
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 octaves
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 octaves
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.4.4",
3
+ "version": "4.5.1",
4
4
  "description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -38,8 +38,8 @@
38
38
  "@thi.ng/checks": "^3.4.5",
39
39
  "@thi.ng/errors": "^2.3.5",
40
40
  "@thi.ng/math": "^5.6.1",
41
- "@thi.ng/random": "^3.6.4",
42
- "@thi.ng/transducers": "^8.6.5"
41
+ "@thi.ng/random": "^3.6.5",
42
+ "@thi.ng/transducers": "^8.7.1"
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": "1bbef970bab7f7def0700e587cf0471e1e1ef9f3\n"
278
+ "gitHead": "c22e8996cee284ebe8ea88582beb1ab5fc6ee503\n"
279
279
  }