@thi.ng/dsp 4.7.20 → 4.7.21
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/addg.d.ts +4 -2
- package/convert.d.ts +4 -2
- package/curve.d.ts +4 -2
- package/fft.d.ts +18 -10
- package/line.d.ts +4 -2
- package/osc.d.ts +1 -2
- package/package.json +12 -12
- package/sweep.d.ts +6 -4
package/CHANGELOG.md
CHANGED
package/addg.d.ts
CHANGED
|
@@ -9,10 +9,12 @@ import type { IGen } from "./api.js";
|
|
|
9
9
|
* gen.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
* ```ts
|
|
12
|
+
* ```ts tangle:../export/addg.ts
|
|
13
13
|
* import { addG, constant } from "@thi.ng/dsp";
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* console.log(
|
|
16
|
+
* addG(constant(1), 10).take(5)
|
|
17
|
+
* );
|
|
16
18
|
* // [ 10, 11, 12, 13, 14 ]
|
|
17
19
|
* ```
|
|
18
20
|
*
|
package/convert.d.ts
CHANGED
|
@@ -33,11 +33,13 @@ export declare const radFreq: FnN2;
|
|
|
33
33
|
* rate.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
|
-
* ```ts
|
|
36
|
+
* ```ts tangle:../export/ms-frames.ts
|
|
37
37
|
* import { msFrames } from "@thi.ng/dsp";
|
|
38
38
|
*
|
|
39
39
|
* // samples per 20 ms @ 44.1kHz
|
|
40
|
-
*
|
|
40
|
+
* console.log(
|
|
41
|
+
* msFrames(20, 44100)
|
|
42
|
+
* );
|
|
41
43
|
* // 882
|
|
42
44
|
* ```
|
|
43
45
|
*
|
package/curve.d.ts
CHANGED
|
@@ -16,10 +16,12 @@ import { MAdd } from "./madd.js";
|
|
|
16
16
|
* Also see {@link madd}.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* ```ts
|
|
19
|
+
* ```ts tangle:../export/curve.ts
|
|
20
20
|
* import { curve } from "@thi.ng/dsp";
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* console.log(
|
|
23
|
+
* curve(-1, 1, 5, 0.1).take(7)
|
|
24
|
+
* );
|
|
23
25
|
* // [
|
|
24
26
|
* // -1,
|
|
25
27
|
* // -0.04228753006664476,
|
package/fft.d.ts
CHANGED
|
@@ -28,28 +28,36 @@ export declare const copyComplex: (complex: ComplexArray) => ComplexArray;
|
|
|
28
28
|
* reverse order.
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
|
-
* ```ts
|
|
31
|
+
* ```ts tangle:../export/conjugate1.ts
|
|
32
32
|
* import { conjugate } from "@thi.ng/dsp";
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* console.log(
|
|
35
|
+
* conjugate([0, 3, 2, 1], true)
|
|
36
|
+
* );
|
|
35
37
|
* // Float64Array [ 0, 3, 2, 1, 0, -1, -2, -3 ]
|
|
36
38
|
*
|
|
37
|
-
*
|
|
39
|
+
* console.log(
|
|
40
|
+
* conjugate([0, 3, 2, 1], false)
|
|
41
|
+
* );
|
|
38
42
|
* // Float64Array [ 0, 3, 2, 1, 0, 1, 2, 3 ]
|
|
39
43
|
*
|
|
40
|
-
*
|
|
41
|
-
* [
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* ]
|
|
44
|
+
* console.log(
|
|
45
|
+
* conjugate([[0, 1, 0, 1], [0, -0.5, 0, -0.25]])
|
|
46
|
+
* );
|
|
47
|
+
* // [
|
|
48
|
+
* // Float64Array [ 0, 1, 0, 1, 0, 1, 0, 1 ],
|
|
49
|
+
* // Float64Array [ 0, -0.5, 0, -0.25, 0, 0.25, 0, 0.5 ]
|
|
50
|
+
* // ]
|
|
45
51
|
* ```
|
|
46
52
|
*
|
|
47
53
|
* @example
|
|
48
|
-
* ```ts
|
|
54
|
+
* ```ts tangle:../export/conjugate2.ts
|
|
49
55
|
* import { conjugate, ifft } from "@thi.ng/dsp";
|
|
50
56
|
*
|
|
51
57
|
* // generate single-period sine (window size = 16)
|
|
52
|
-
*
|
|
58
|
+
* console.log(
|
|
59
|
+
* ifft(conjugate([0, -8, 0, 0, 0, 0, 0, 0]))[0]
|
|
60
|
+
* );
|
|
53
61
|
* // [
|
|
54
62
|
* // 0, 0.383, 0.707, 0.924,
|
|
55
63
|
* // 1, 0.924, 0.707, 0.383,
|
package/line.d.ts
CHANGED
|
@@ -10,10 +10,12 @@ import { Add } from "./add.js";
|
|
|
10
10
|
* if more than `n + 1` values are requested from the generator.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
|
-
* ```ts
|
|
13
|
+
* ```ts tangle:../export/line.ts
|
|
14
14
|
* import { line } from "@thi.ng/dsp";
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* console.log(
|
|
17
|
+
* line(0, 1, 5).take(7)
|
|
18
|
+
* );
|
|
17
19
|
* // [ 0, 0.2, 0.4, 0.6, 0.8, 1, 1.2 ]
|
|
18
20
|
* ```
|
|
19
21
|
*
|
package/osc.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const osc: (osc: StatelessOscillator, freq: IGen<number> | number
|
|
|
33
33
|
* range, added to the main oscillator `freq`.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
|
-
* ```ts
|
|
36
|
+
* ```ts tangle:../export/mod-osc.ts
|
|
37
37
|
* import { modOsc, osc, saw, sin, rect } from "@thi.ng/dsp";
|
|
38
38
|
*
|
|
39
39
|
* // FM sin osc using rect osc as frequency modulator
|
|
@@ -44,7 +44,6 @@ export declare const osc: (osc: StatelessOscillator, freq: IGen<number> | number
|
|
|
44
44
|
*
|
|
45
45
|
* // FM & AM sin osc using rect osc as fmod and saw as amod
|
|
46
46
|
* modOsc(sin, 0.01, osc(rect, 0.1, 0.2), osc(saw, 0.05))
|
|
47
|
-
*
|
|
48
47
|
* ```
|
|
49
48
|
*
|
|
50
49
|
* @param osc - stateless main osc
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/dsp",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.21",
|
|
4
4
|
"description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@thi.ng/api": "^8.9.
|
|
41
|
-
"@thi.ng/checks": "^3.5.
|
|
42
|
-
"@thi.ng/errors": "^2.
|
|
43
|
-
"@thi.ng/math": "^5.10.
|
|
44
|
-
"@thi.ng/random": "^3.6.
|
|
45
|
-
"@thi.ng/transducers": "^8.9.
|
|
40
|
+
"@thi.ng/api": "^8.9.30",
|
|
41
|
+
"@thi.ng/checks": "^3.5.3",
|
|
42
|
+
"@thi.ng/errors": "^2.5.0",
|
|
43
|
+
"@thi.ng/math": "^5.10.7",
|
|
44
|
+
"@thi.ng/random": "^3.6.37",
|
|
45
|
+
"@thi.ng/transducers": "^8.9.12"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.
|
|
49
|
-
"esbuild": "^0.20.
|
|
48
|
+
"@microsoft/api-extractor": "^7.42.3",
|
|
49
|
+
"esbuild": "^0.20.1",
|
|
50
50
|
"rimraf": "^5.0.5",
|
|
51
|
-
"typedoc": "^0.25.
|
|
52
|
-
"typescript": "^5.
|
|
51
|
+
"typedoc": "^0.25.12",
|
|
52
|
+
"typescript": "^5.4.2"
|
|
53
53
|
},
|
|
54
54
|
"keywords": [
|
|
55
55
|
"allpass",
|
|
@@ -289,5 +289,5 @@
|
|
|
289
289
|
],
|
|
290
290
|
"year": 2015
|
|
291
291
|
},
|
|
292
|
-
"gitHead": "
|
|
292
|
+
"gitHead": "7f3fcbd6c0462b0ce45afa141fe163d1f297fd51\n"
|
|
293
293
|
}
|
package/sweep.d.ts
CHANGED
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
* clamped at the given `end` value.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* ```ts
|
|
8
|
+
* ```ts tangle:../export/sweep.ts
|
|
9
9
|
* import { adsr, osc, sin, sweep } from "@thi.ng/dsp";
|
|
10
10
|
*
|
|
11
|
+
* // sample rate
|
|
12
|
+
* const FS = 44100
|
|
13
|
+
*
|
|
11
14
|
* // render 2 sec osc sweep from 100 - 10000Hz
|
|
12
|
-
* // FS = 44100
|
|
13
15
|
* osc(
|
|
14
16
|
* sin,
|
|
15
17
|
* // freq & phase gen
|
|
16
18
|
* sweep(100 / FS, 10000 / FS, 2 * FS, 0.1),
|
|
17
19
|
* // amplitude gen / envelope
|
|
18
|
-
* adsr(0.5 * FS, 1.5 * FS, 0)
|
|
19
|
-
* ).take(2 *
|
|
20
|
+
* adsr({ a: 0.5 * FS, r: 1.5 * FS, slen: 0 })
|
|
21
|
+
* ).take(2 * FS)
|
|
20
22
|
* // [...]
|
|
21
23
|
* ```
|
|
22
24
|
*
|