@thi.ng/dsp 3.0.31 → 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.
- package/CHANGELOG.md +82 -69
- package/README.md +66 -57
- package/{gen/add.d.ts → add.d.ts} +4 -2
- package/{gen/add.js → add.js} +7 -2
- package/{comp/addg.d.ts → addg.d.ts} +1 -1
- package/{comp/addg.js → addg.js} +0 -0
- package/{gen/adsr.d.ts → adsr.d.ts} +1 -1
- package/{gen/adsr.js → adsr.js} +22 -2
- package/{gen/agen.d.ts → agen.d.ts} +1 -1
- package/{gen/agen.js → agen.js} +3 -4
- package/{proc/allpass.d.ts → allpass.d.ts} +0 -0
- package/{proc/allpass.js → allpass.js} +5 -1
- package/{gen/alt.d.ts → alt.d.ts} +0 -0
- package/{gen/alt.js → alt.js} +3 -1
- package/{util/anti-alias.d.ts → anti-alias.d.ts} +0 -0
- package/{util/anti-alias.js → anti-alias.js} +1 -1
- package/{proc/aproc.d.ts → aproc.d.ts} +6 -4
- package/{proc/aproc.js → aproc.js} +8 -4
- package/{proc/biquad.d.ts → biquad.d.ts} +1 -1
- package/{proc/biquad.js → biquad.js} +15 -3
- package/bounce.d.ts +13 -0
- package/bounce.js +18 -0
- package/{util/complex.d.ts → complex.d.ts} +1 -1
- package/{util/complex.js → complex.js} +1 -1
- package/{gen/const.d.ts → const.d.ts} +0 -0
- package/{gen/const.js → const.js} +0 -0
- package/{util/convert.d.ts → convert.d.ts} +0 -0
- package/{util/convert.js → convert.js} +1 -1
- package/{gen/cosine.d.ts → cosine.d.ts} +0 -0
- package/{gen/cosine.js → cosine.js} +5 -1
- package/{gen/curve.d.ts → curve.d.ts} +0 -0
- package/{gen/curve.js → curve.js} +0 -0
- package/{proc/dcblock.d.ts → dcblock.d.ts} +0 -0
- package/{proc/dcblock.js → dcblock.js} +0 -0
- package/{proc/delay.d.ts → delay.d.ts} +0 -0
- package/{proc/delay.js → delay.js} +6 -2
- package/{proc/feedback-delay.d.ts → feedback-delay.d.ts} +0 -0
- package/{proc/feedback-delay.js → feedback-delay.js} +2 -1
- package/{fft/fft.d.ts → fft.d.ts} +1 -1
- package/{fft/fft.js → fft.js} +2 -2
- package/{util/filter-response.d.ts → filter-response.d.ts} +1 -1
- package/{util/filter-response.js → filter-response.js} +3 -2
- package/{proc/foldback.d.ts → foldback.d.ts} +0 -0
- package/{proc/foldback.js → foldback.js} +3 -1
- package/{gen/impulse-train.d.ts → impulse-train.d.ts} +0 -0
- package/{gen/impulse-train.js → impulse-train.js} +5 -0
- package/{gen/impulse.d.ts → impulse.d.ts} +0 -0
- package/{gen/impulse.js → impulse.js} +2 -0
- package/index.d.ts +56 -55
- package/index.js +56 -55
- package/{proc/integrator.d.ts → integrator.d.ts} +0 -0
- package/{proc/integrator.js → integrator.js} +2 -0
- package/internal/take.d.ts +3 -0
- package/internal/take.js +6 -0
- package/{gen/iterable.d.ts → iterable.d.ts} +1 -1
- package/{gen/iterable.js → iterable.js} +4 -4
- package/{gen/line.d.ts → line.d.ts} +0 -0
- package/{gen/line.js → line.js} +0 -0
- package/{gen/madd.d.ts → madd.d.ts} +0 -0
- package/{gen/madd.js → madd.js} +4 -0
- package/{comp/mapg.d.ts → mapg.d.ts} +2 -2
- package/{comp/mapg.js → mapg.js} +16 -2
- package/{proc/mix.d.ts → mix.d.ts} +0 -0
- package/{proc/mix.js → mix.js} +2 -1
- package/{gen/mul.d.ts → mul.d.ts} +0 -0
- package/{gen/mul.js → mul.js} +3 -0
- package/multiplex.d.ts +26 -0
- package/{comp/multiplex.js → multiplex.js} +2 -1
- package/{proc/onepole.d.ts → onepole.d.ts} +1 -1
- package/{proc/onepole.js → onepole.js} +6 -1
- package/{osc/additive.d.ts → osc-additive.d.ts} +16 -2
- package/{osc/additive.js → osc-additive.js} +16 -2
- package/osc-cos.d.ts +3 -0
- package/{osc/cos.js → osc-cos.js} +1 -1
- package/{osc/dsf.d.ts → osc-dsf.d.ts} +2 -2
- package/{osc/dsf.js → osc-dsf.js} +1 -1
- package/{osc/mix.d.ts → osc-mix.d.ts} +2 -2
- package/{osc/mix.js → osc-mix.js} +1 -1
- package/{osc/parabolic.d.ts → osc-parabolic.d.ts} +2 -2
- package/{osc/parabolic.js → osc-parabolic.js} +1 -1
- package/{osc/rect.d.ts → osc-rect.d.ts} +2 -2
- package/{osc/rect.js → osc-rect.js} +1 -1
- package/osc-saw.d.ts +3 -0
- package/{osc/saw.js → osc-saw.js} +1 -1
- package/osc-sin.d.ts +3 -0
- package/{osc/sin.js → osc-sin.js} +1 -1
- package/osc-tri.d.ts +3 -0
- package/{osc/tri.js → osc-tri.js} +1 -1
- package/{osc/wavetable.d.ts → osc-wavetable.d.ts} +2 -2
- package/{osc/wavetable.js → osc-wavetable.js} +2 -1
- package/{gen/osc.d.ts → osc.d.ts} +1 -1
- package/{gen/osc.js → osc.js} +6 -2
- package/package.json +201 -33
- package/{gen/pink-noise.d.ts → pink-noise.d.ts} +1 -1
- package/{gen/pink-noise.js → pink-noise.js} +6 -1
- package/{comp/pipe.d.ts → pipe.d.ts} +8 -1
- package/{comp/pipe.js → pipe.js} +0 -0
- package/{fft/power.d.ts → power.d.ts} +1 -1
- package/{fft/power.js → power.js} +2 -2
- package/{comp/product.d.ts → product.d.ts} +1 -1
- package/{comp/product.js → product.js} +0 -0
- package/{gen/reciprocal.d.ts → reciprocal.d.ts} +0 -0
- package/{gen/reciprocal.js → reciprocal.js} +2 -0
- package/serial.d.ts +44 -0
- package/{comp/compp.js → serial.js} +20 -10
- package/{gen/sincos.d.ts → sincos.d.ts} +0 -0
- package/{gen/sincos.js → sincos.js} +6 -1
- package/{comp/sum.d.ts → sum.d.ts} +1 -1
- package/{comp/sum.js → sum.js} +0 -0
- package/{proc/svf.d.ts → svf.d.ts} +1 -1
- package/{proc/svf.js → svf.js} +11 -1
- package/{gen/sweep.d.ts → sweep.d.ts} +1 -1
- package/{gen/sweep.js → sweep.js} +1 -1
- package/{proc/waveshaper.d.ts → waveshaper.d.ts} +0 -0
- package/{proc/waveshaper.js → waveshaper.js} +5 -1
- package/{gen/white-noise.d.ts → white-noise.d.ts} +1 -1
- package/{gen/white-noise.js → white-noise.js} +3 -1
- package/{fft/window.d.ts → window.d.ts} +1 -1
- package/{fft/window.js → window.js} +2 -2
- package/comp/compp.d.ts +0 -33
- package/comp/multiplex.d.ts +0 -11
- package/lib/index.js +0 -1703
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
- package/osc/cos.d.ts +0 -3
- package/osc/saw.d.ts +0 -3
- package/osc/sin.d.ts +0 -3
- package/osc/tri.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,117 +3,130 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @thi.ng/dsp
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
# [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@3.0.31...@thi.ng/dsp@4.0.0) (2021-10-12)
|
|
11
7
|
|
|
12
8
|
|
|
9
|
+
### Build System
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
15
12
|
|
|
16
13
|
|
|
17
|
-
###
|
|
14
|
+
### Features
|
|
18
15
|
|
|
19
|
-
* **
|
|
16
|
+
* **dsp:** restructure/flatten /src folder, add ops ([c001e6f](https://github.com/thi-ng/umbrella/commit/c001e6f86bcb132323bde974a23cf1e69421142f))
|
|
20
17
|
|
|
21
18
|
|
|
22
|
-
###
|
|
19
|
+
### BREAKING CHANGES
|
|
23
20
|
|
|
24
|
-
* **dsp:**
|
|
25
|
-
* **dsp:** add cos() stateless oscillator ([276c6b7](https://github.com/thi-ng/umbrella/commit/276c6b76a6b69498f3b37c94fc34c4915b95b9b6))
|
|
26
|
-
* **dsp:** add power & integral fns ([88edaac](https://github.com/thi-ng/umbrella/commit/88edaac0b93fb811738cbfd06d41063d8c4b9aff))
|
|
27
|
-
* **dsp:** add windowWelch(), add docs ([84cd476](https://github.com/thi-ng/umbrella/commit/84cd4763a2a897d6b15b21b680fe2c8bd15c9d4a))
|
|
28
|
-
* **dsp:** add/update power & integral fns ([f455fad](https://github.com/thi-ng/umbrella/commit/f455fad649394cd386839d983d8ae25895f9f1a2))
|
|
29
|
-
* **dsp:** add/update various FFT & spectrum fns (fix [#258](https://github.com/thi-ng/umbrella/issues/258)) ([e351acb](https://github.com/thi-ng/umbrella/commit/e351acb98b1c776a6c8efe9ba910c2ec3b2df831))
|
|
21
|
+
* **dsp:** restructure pkg, add/rename ops
|
|
30
22
|
|
|
23
|
+
- dissolve all subfolders
|
|
24
|
+
- add bounce()
|
|
25
|
+
- rename `compP()` => `serial()`
|
|
26
|
+
- add docs
|
|
27
|
+
* discontinue CommonJS & UMD versions
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
- only ESM modules will be published from now on
|
|
30
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
31
|
+
- i.e. launch NodeJS via:
|
|
32
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
33
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
34
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
Also:
|
|
37
|
+
- normalize/restructure/reorg all package.json files
|
|
38
|
+
- cleanup all build scripts, remove obsolete
|
|
39
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
35
40
|
|
|
36
|
-
- FilterType
|
|
37
|
-
- BiquadType
|
|
38
|
-
- SVFType
|
|
39
|
-
- OnepoleType
|
|
40
|
-
* **dsp:** new args for normalizeFFT(),denormalizeFFT(), spectrumPow()
|
|
41
41
|
|
|
42
|
-
- add support for windowing adjustments in above functions
|
|
43
|
-
- add thresholdFFT()
|
|
44
|
-
- add copyComplex()
|
|
45
|
-
- update various real/complex checks using isComplex()
|
|
46
|
-
- update docs, add references
|
|
47
42
|
|
|
48
43
|
|
|
49
44
|
|
|
50
45
|
|
|
46
|
+
# [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@2.1.5...@thi.ng/dsp@3.0.0) (2020-12-22)
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
### Code Refactoring
|
|
53
49
|
|
|
50
|
+
- **adjacency:** fix [#256](https://github.com/thi-ng/umbrella/issues/256) replace enums w/ type aliases ([b9cfacb](https://github.com/thi-ng/umbrella/commit/b9cfacbbb67fcb89d72090bdad512edaffa1adcf))
|
|
54
51
|
|
|
55
|
-
###
|
|
52
|
+
### Features
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
- **dsp:** add applyWindow(), windowBartlett() ([d51a17c](https://github.com/thi-ng/umbrella/commit/d51a17c10dd6cbfbb69bb1cf09f46e59d2dd8ba2))
|
|
55
|
+
- **dsp:** add cos() stateless oscillator ([276c6b7](https://github.com/thi-ng/umbrella/commit/276c6b76a6b69498f3b37c94fc34c4915b95b9b6))
|
|
56
|
+
- **dsp:** add power & integral fns ([88edaac](https://github.com/thi-ng/umbrella/commit/88edaac0b93fb811738cbfd06d41063d8c4b9aff))
|
|
57
|
+
- **dsp:** add windowWelch(), add docs ([84cd476](https://github.com/thi-ng/umbrella/commit/84cd4763a2a897d6b15b21b680fe2c8bd15c9d4a))
|
|
58
|
+
- **dsp:** add/update power & integral fns ([f455fad](https://github.com/thi-ng/umbrella/commit/f455fad649394cd386839d983d8ae25895f9f1a2))
|
|
59
|
+
- **dsp:** add/update various FFT & spectrum fns (fix [#258](https://github.com/thi-ng/umbrella/issues/258)) ([e351acb](https://github.com/thi-ng/umbrella/commit/e351acb98b1c776a6c8efe9ba910c2ec3b2df831))
|
|
58
60
|
|
|
61
|
+
### BREAKING CHANGES
|
|
59
62
|
|
|
63
|
+
- **adjacency:** replace filter type enums w/ type aliases
|
|
64
|
+
- FilterType
|
|
65
|
+
- BiquadType
|
|
66
|
+
- SVFType
|
|
67
|
+
- OnepoleType
|
|
68
|
+
- **dsp:** new args for normalizeFFT(),denormalizeFFT(), spectrumPow()
|
|
69
|
+
- add support for windowing adjustments in above functions
|
|
70
|
+
- add thresholdFFT()
|
|
71
|
+
- add copyComplex()
|
|
72
|
+
- update various real/complex checks using isComplex()
|
|
73
|
+
- update docs, add references
|
|
60
74
|
|
|
75
|
+
# [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@2.0.28...@thi.ng/dsp@2.1.0) (2020-08-28)
|
|
61
76
|
|
|
77
|
+
### Features
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
- **dsp:** add iterable() wrapper ([94fb8ed](https://github.com/thi-ng/umbrella/commit/94fb8ed3a91ea45dcb53961a3b1c4a6a96cb2fb0))
|
|
64
80
|
|
|
65
|
-
|
|
81
|
+
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@1.0.18...@thi.ng/dsp@2.0.0) (2020-01-24)
|
|
66
82
|
|
|
67
|
-
|
|
83
|
+
### Code Refactoring
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
- **dsp:** remove obsolete classes ([aa24c1e](https://github.com/thi-ng/umbrella/commit/aa24c1e4d9272f6ed468c011c00ab7c1b3e6c4f7))
|
|
70
86
|
|
|
71
|
-
|
|
72
|
-
* **dsp:** add fft, spectrum and window fns, add tests ([f918af4](https://github.com/thi-ng/umbrella/commit/f918af4e4169f75a0168098083e6b7fab4eba551))
|
|
73
|
-
* **dsp:** add filters, refactor, update pkg/docs/readme ([7758609](https://github.com/thi-ng/umbrella/commit/775860996c09ea540d397702040ab4d53a338830))
|
|
74
|
-
* **dsp:** add gen/proc composition ops, restructure ([8be2a5f](https://github.com/thi-ng/umbrella/commit/8be2a5f9fee18e2fdf7aefb48455b38511de5569))
|
|
75
|
-
* **dsp:** add LFO sin/cos iterator/osc, minor refactor window fns ([dc89204](https://github.com/thi-ng/umbrella/commit/dc892043bb94b759ec04547b9194d8cfdbd9aa2f))
|
|
76
|
-
* **dsp:** add missing factory fns, update docstrings ([3ede5af](https://github.com/thi-ng/umbrella/commit/3ede5af1c85564a4aa974f3a77c18a12f3bb6073))
|
|
77
|
-
* **dsp:** add new operators ([68a88e4](https://github.com/thi-ng/umbrella/commit/68a88e4774979ef1a81149dd233324cdbc8b3787))
|
|
78
|
-
* **dsp:** add sweep(), move curve(), minor refactor ([0b24d80](https://github.com/thi-ng/umbrella/commit/0b24d8035d8da716f14644c76b7768ba75b84189))
|
|
79
|
-
* **dsp:** add/rename oscillators ([8a826bf](https://github.com/thi-ng/umbrella/commit/8a826bf0f0ead26e7da52ef79c911290942c80fb))
|
|
80
|
-
* **dsp:** add/update FFT fns, test, update docs ([1ac9508](https://github.com/thi-ng/umbrella/commit/1ac95080da1da7d07212dcc65a1d97917c644d7f))
|
|
81
|
-
* **dsp:** add/update filters, filter resp, delay ([2854b09](https://github.com/thi-ng/umbrella/commit/2854b096fdbe05f05b542c87a80bf08bb2b14ffe))
|
|
82
|
-
* **dsp:** import gen & proc nodes, general pkg restructure ([a85c3cf](https://github.com/thi-ng/umbrella/commit/a85c3cf3c80c3714637fc4f3410742a88356f78f))
|
|
83
|
-
* **dsp:** update ADSR, add ADSROpts, auto-release ([16f41ec](https://github.com/thi-ng/umbrella/commit/16f41ec4a60ea80ee9e544641f034491b7814754))
|
|
84
|
-
* **dsp:** update all gens/procs, housekeeping, docs ([e483245](https://github.com/thi-ng/umbrella/commit/e483245d48b8ae0c74d93d1f2f2270a2379c642b))
|
|
85
|
-
* **dsp:** update DelayLine ctor, freqBin, update pkg ([228a81e](https://github.com/thi-ng/umbrella/commit/228a81e951203e4e215de825d2474ec302290727))
|
|
86
|
-
* **dsp:** update gens to support clamping ([fe8f6f3](https://github.com/thi-ng/umbrella/commit/fe8f6f347b9a9a618cfd30b95739f9400cc197d6))
|
|
87
|
+
### Features
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
- **dsp:** add DelayLine ([bd25cd7](https://github.com/thi-ng/umbrella/commit/bd25cd7482d40ad21b713c6c6f7086458b5adbd0))
|
|
90
|
+
- **dsp:** add fft, spectrum and window fns, add tests ([f918af4](https://github.com/thi-ng/umbrella/commit/f918af4e4169f75a0168098083e6b7fab4eba551))
|
|
91
|
+
- **dsp:** add filters, refactor, update pkg/docs/readme ([7758609](https://github.com/thi-ng/umbrella/commit/775860996c09ea540d397702040ab4d53a338830))
|
|
92
|
+
- **dsp:** add gen/proc composition ops, restructure ([8be2a5f](https://github.com/thi-ng/umbrella/commit/8be2a5f9fee18e2fdf7aefb48455b38511de5569))
|
|
93
|
+
- **dsp:** add LFO sin/cos iterator/osc, minor refactor window fns ([dc89204](https://github.com/thi-ng/umbrella/commit/dc892043bb94b759ec04547b9194d8cfdbd9aa2f))
|
|
94
|
+
- **dsp:** add missing factory fns, update docstrings ([3ede5af](https://github.com/thi-ng/umbrella/commit/3ede5af1c85564a4aa974f3a77c18a12f3bb6073))
|
|
95
|
+
- **dsp:** add new operators ([68a88e4](https://github.com/thi-ng/umbrella/commit/68a88e4774979ef1a81149dd233324cdbc8b3787))
|
|
96
|
+
- **dsp:** add sweep(), move curve(), minor refactor ([0b24d80](https://github.com/thi-ng/umbrella/commit/0b24d8035d8da716f14644c76b7768ba75b84189))
|
|
97
|
+
- **dsp:** add/rename oscillators ([8a826bf](https://github.com/thi-ng/umbrella/commit/8a826bf0f0ead26e7da52ef79c911290942c80fb))
|
|
98
|
+
- **dsp:** add/update FFT fns, test, update docs ([1ac9508](https://github.com/thi-ng/umbrella/commit/1ac95080da1da7d07212dcc65a1d97917c644d7f))
|
|
99
|
+
- **dsp:** add/update filters, filter resp, delay ([2854b09](https://github.com/thi-ng/umbrella/commit/2854b096fdbe05f05b542c87a80bf08bb2b14ffe))
|
|
100
|
+
- **dsp:** import gen & proc nodes, general pkg restructure ([a85c3cf](https://github.com/thi-ng/umbrella/commit/a85c3cf3c80c3714637fc4f3410742a88356f78f))
|
|
101
|
+
- **dsp:** update ADSR, add ADSROpts, auto-release ([16f41ec](https://github.com/thi-ng/umbrella/commit/16f41ec4a60ea80ee9e544641f034491b7814754))
|
|
102
|
+
- **dsp:** update all gens/procs, housekeeping, docs ([e483245](https://github.com/thi-ng/umbrella/commit/e483245d48b8ae0c74d93d1f2f2270a2379c642b))
|
|
103
|
+
- **dsp:** update DelayLine ctor, freqBin, update pkg ([228a81e](https://github.com/thi-ng/umbrella/commit/228a81e951203e4e215de825d2474ec302290727))
|
|
104
|
+
- **dsp:** update gens to support clamping ([fe8f6f3](https://github.com/thi-ng/umbrella/commit/fe8f6f347b9a9a618cfd30b95739f9400cc197d6))
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
(superceded by osc()/modOsc())
|
|
106
|
+
### BREAKING CHANGES
|
|
92
107
|
|
|
93
|
-
|
|
108
|
+
- **dsp:** remove obsolete Oscillator/AMFMOscillator (superceded by osc()/modOsc())
|
|
94
109
|
|
|
95
|
-
|
|
110
|
+
## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@1.0.9...@thi.ng/dsp@1.0.10) (2019-04-26)
|
|
96
111
|
|
|
97
|
-
|
|
112
|
+
### Bug Fixes
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
- **dsp:** fix tri() oscillator for negative phases ([c67c733](https://github.com/thi-ng/umbrella/commit/c67c733))
|
|
100
115
|
|
|
101
|
-
|
|
116
|
+
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@0.1.3...@thi.ng/dsp@1.0.0) (2019-01-21)
|
|
102
117
|
|
|
103
|
-
|
|
118
|
+
### Build System
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
### BREAKING CHANGES
|
|
108
123
|
|
|
109
|
-
-
|
|
110
|
-
|
|
111
|
-
- all imports MUST be updated to only refer to package level
|
|
112
|
-
(not individual files anymore). tree shaking in user land will get rid of
|
|
113
|
-
all unused imported symbols.
|
|
124
|
+
- enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
125
|
+
- build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
126
|
+
- all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols.
|
|
114
127
|
|
|
115
|
-
#
|
|
128
|
+
# 0.1.0 (2018-10-17)
|
|
116
129
|
|
|
117
|
-
###
|
|
130
|
+
### Features
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
- **dsp:** add oscillators as [@thi](https://github.com/thi).ng/dsp package (from synstack / VEX) ([889730f](https://github.com/thi-ng/umbrella/commit/889730f))
|
package/README.md
CHANGED
|
@@ -69,15 +69,23 @@ might be ported to WASM.
|
|
|
69
69
|
yarn add @thi.ng/dsp
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
ES module import:
|
|
73
|
+
|
|
72
74
|
```html
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/dsp"></script>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
79
|
+
|
|
80
|
+
For NodeJS (v14.6+):
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
node --experimental-specifier-resolution=node --experimental-repl-await
|
|
75
84
|
|
|
76
|
-
|
|
77
|
-
<script src="https://unpkg.com/@thi.ng/dsp/lib/index.umd.js" crossorigin></script>
|
|
85
|
+
> const dsp = await import("@thi.ng/dsp");
|
|
78
86
|
```
|
|
79
87
|
|
|
80
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
88
|
+
Package sizes (gzipped, pre-treeshake): ESM: 7.43 KB
|
|
81
89
|
|
|
82
90
|
## Dependencies
|
|
83
91
|
|
|
@@ -96,11 +104,12 @@ directory are using this package.
|
|
|
96
104
|
|
|
97
105
|
A selection:
|
|
98
106
|
|
|
99
|
-
| Screenshot
|
|
100
|
-
|
|
101
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/>
|
|
102
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/>
|
|
103
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/webgl-
|
|
107
|
+
| Screenshot | Description | Live demo | Source |
|
|
108
|
+
|:---------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------|:----------------------------------------------------|:---------------------------------------------------------------------------------|
|
|
109
|
+
| <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) |
|
|
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/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) |
|
|
112
|
+
| <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) |
|
|
104
113
|
|
|
105
114
|
## API
|
|
106
115
|
|
|
@@ -174,36 +183,36 @@ import { take } from "@thi.ng/transducers";
|
|
|
174
183
|
// ]
|
|
175
184
|
```
|
|
176
185
|
|
|
177
|
-
- [add](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
178
|
-
- [adsr](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
179
|
-
- [alt](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
180
|
-
- [constant](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
181
|
-
- [cosine](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
182
|
-
- [curve](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
183
|
-
- [impulse](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
184
|
-
- [impulseTrain](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
185
|
-
- [line](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
186
|
-
- [madd](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
187
|
-
- [mul](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
188
|
-
- [pinkNoise](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
189
|
-
- [reciprocal](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
190
|
-
- [sincos](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
191
|
-
- [sweep](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
192
|
-
- [whiteNoise](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
186
|
+
- [add](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/add.ts) - adder
|
|
187
|
+
- [adsr](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/add.ts) - timebased ADSR / AD envelope generator
|
|
188
|
+
- [alt](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/alt.ts) - alternating values
|
|
189
|
+
- [constant](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/const.ts) - constant value
|
|
190
|
+
- [cosine](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/cosp.ts) - trig-free cosine osc
|
|
191
|
+
- [curve](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/curve.ts) - timebased exponential gain/decay (factory for `madd`)
|
|
192
|
+
- [impulse](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/impulse.ts) - impulse gen
|
|
193
|
+
- [impulseTrain](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/impulse-train.ts) - timebased cyclic impulse
|
|
194
|
+
- [line](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/line.ts) - timebased line gen (factory for `add`)
|
|
195
|
+
- [madd](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/madd.ts) - multiply-adder
|
|
196
|
+
- [mul](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/mul.ts) - multiplier (exponential gain/decay)
|
|
197
|
+
- [pinkNoise](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/pink-noise.ts) - configurable pink noise (1/f power spectrum)
|
|
198
|
+
- [reciprocal](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/reciprocal.ts) - fractional sequence (1, 1/2, 1/3, 1/4 etc.)
|
|
199
|
+
- [sincos](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/sincos.ts) - trig-free sin/cos LFO
|
|
200
|
+
- [sweep](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/sweep.ts) - freq sweep gen w/ phase accumulation for oscillators
|
|
201
|
+
- [whiteNoise](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/pink-noise.ts) - white noise
|
|
193
202
|
|
|
194
203
|
#### Higher order generators
|
|
195
204
|
|
|
196
|
-
- [mapG](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
197
|
-
- [addG](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
198
|
-
- [product](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
199
|
-
- [sum](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
205
|
+
- [mapG](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/mapg.ts) - `IGen` composition / transformation (1-4 inputs)
|
|
206
|
+
- [addG](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/addg.ts) - higher-order adder
|
|
207
|
+
- [product](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/product.ts) - product of input gens
|
|
208
|
+
- [sum](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/sum.ts) - sum of input gens
|
|
200
209
|
|
|
201
210
|
#### Oscillators
|
|
202
211
|
|
|
203
212
|
##### IGen wrappers
|
|
204
213
|
|
|
205
|
-
- [osc](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
206
|
-
- [modOsc](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
214
|
+
- [osc](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc.ts) - arbitrary function oscillator w/ modulation support
|
|
215
|
+
- [modOsc](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc.ts) - FM / FMAM oscillator builder
|
|
207
216
|
|
|
208
217
|
```ts
|
|
209
218
|
const FS = 44100;
|
|
@@ -237,17 +246,17 @@ Diagram of the FM/AM osc with some low pass filters applied:
|
|
|
237
246
|
|
|
238
247
|
##### Stateless oscillator functions
|
|
239
248
|
|
|
240
|
-
- [additive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
241
|
-
- [dsf](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
242
|
-
- [mix](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
243
|
-
- [parabolic](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
244
|
-
- [rect](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
245
|
-
- [saw](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
246
|
-
- [sawAdditive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
247
|
-
- [squareAdditive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
248
|
-
- [sin](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
249
|
-
- [tri](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
250
|
-
- [wavetable](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc
|
|
249
|
+
- [additive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-additive.ts)
|
|
250
|
+
- [dsf](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-dsf.ts)
|
|
251
|
+
- [mix](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-mix.ts)
|
|
252
|
+
- [parabolic](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-parabolic.ts)
|
|
253
|
+
- [rect](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-rect.ts)
|
|
254
|
+
- [saw](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-saw.ts)
|
|
255
|
+
- [sawAdditive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-additive.ts)
|
|
256
|
+
- [squareAdditive](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-additive.ts)
|
|
257
|
+
- [sin](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-sin.ts)
|
|
258
|
+
- [tri](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-tri.ts)
|
|
259
|
+
- [wavetable](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/osc-wavetable.ts)
|
|
251
260
|
|
|
252
261
|
### IProc
|
|
253
262
|
|
|
@@ -318,9 +327,9 @@ The following filter types / functions are available:
|
|
|
318
327
|
|
|
319
328
|
##### 1-pole
|
|
320
329
|
|
|
321
|
-
- [`onepoleLP`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
322
|
-
- [`dcBlock`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
323
|
-
- [`allpass`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
330
|
+
- [`onepoleLP`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/onepole.ts) - low pass, 6dB/oct falloff
|
|
331
|
+
- [`dcBlock`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/dcblock.ts) - high pass, 6dB/oct falloff
|
|
332
|
+
- [`allpass`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/allpass.ts) - allpass (-90° phase shift @ center freq)
|
|
324
333
|
|
|
325
334
|
Low pass:
|
|
326
335
|
|
|
@@ -336,7 +345,7 @@ Allpass:
|
|
|
336
345
|
|
|
337
346
|
##### Biquad
|
|
338
347
|
|
|
339
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
348
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/biquad.ts)
|
|
340
349
|
|
|
341
350
|
- `biquadLP` - low pass, 12dB/oct falloff, resonance
|
|
342
351
|
- `biquadHP` - high pass, 12dB/oct falloff, resonance
|
|
@@ -378,7 +387,7 @@ High shelf (gain = -6dB):
|
|
|
378
387
|
|
|
379
388
|
##### State variable filter
|
|
380
389
|
|
|
381
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
390
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/biquad.ts)
|
|
382
391
|
|
|
383
392
|
- `svfLP` - low pass, resonance
|
|
384
393
|
- `svfHP` - high pass, resonance
|
|
@@ -416,7 +425,7 @@ Allpass:
|
|
|
416
425
|
#### Filter responses
|
|
417
426
|
|
|
418
427
|
Using the [Filter response
|
|
419
|
-
utils](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
428
|
+
utils](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/filter-response.ts),
|
|
420
429
|
the following filter types can be evaluated for analyzing their impact
|
|
421
430
|
on specific frequencies (or frequency bands). Any type implementing
|
|
422
431
|
[`IFilter`](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/api.ts#L50)
|
|
@@ -459,7 +468,7 @@ Basic filter response plot:
|
|
|
459
468
|
|
|
460
469
|
#### Delay
|
|
461
470
|
|
|
462
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
471
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/delay.ts)
|
|
463
472
|
|
|
464
473
|
Ringbuffer / delay line for arbitrary values and support for single &
|
|
465
474
|
multi-taps at any relative positions. Useful fundamental building block
|
|
@@ -467,14 +476,14 @@ for various other effects, filters etc.
|
|
|
467
476
|
|
|
468
477
|
#### Feedback delay
|
|
469
478
|
|
|
470
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
479
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/feedback-delay.ts)
|
|
471
480
|
|
|
472
481
|
Variation of `delay()` which adds a portion of the delayed value to each
|
|
473
482
|
new input and stores result in delay line.
|
|
474
483
|
|
|
475
484
|
#### Wave shaping
|
|
476
485
|
|
|
477
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
486
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/waveshaper.ts)
|
|
478
487
|
|
|
479
488
|
This operator remaps inputs via a user provided function. The following shaping functions are provided:
|
|
480
489
|
|
|
@@ -499,7 +508,7 @@ Sine:
|
|
|
499
508
|
|
|
500
509
|
#### Foldback distortion
|
|
501
510
|
|
|
502
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
511
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/waveshaper.ts)
|
|
503
512
|
|
|
504
513
|
Recursively folds input into `[-thresh .. +thresh]` interval and amplifies it with `amp` (default: 1/thresh).
|
|
505
514
|
|
|
@@ -510,7 +519,7 @@ Desmos](https://www.desmos.com/calculator/lkyf2ag3ta) to experiment.
|
|
|
510
519
|
|
|
511
520
|
### FFT
|
|
512
521
|
|
|
513
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/fft
|
|
522
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/fft.ts)
|
|
514
523
|
|
|
515
524
|
- `fft()`
|
|
516
525
|
- `ifft()`
|
|
@@ -533,7 +542,7 @@ Desmos](https://www.desmos.com/calculator/lkyf2ag3ta) to experiment.
|
|
|
533
542
|
|
|
534
543
|
#### Window functions
|
|
535
544
|
|
|
536
|
-
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
545
|
+
[Source](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/window.ts)
|
|
537
546
|
|
|
538
547
|
- `window()`
|
|
539
548
|
- `applyWindow()`
|
|
@@ -553,8 +562,8 @@ Desmos](https://www.desmos.com/calculator/lkyf2ag3ta) to experiment.
|
|
|
553
562
|
|
|
554
563
|
### Utilities
|
|
555
564
|
|
|
556
|
-
- [Unit conversions](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
557
|
-
- [Filter response](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/
|
|
565
|
+
- [Unit conversions](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/convert.ts)
|
|
566
|
+
- [Filter response](https://github.com/thi-ng/umbrella/blob/develop/packages/dsp/src/filter-response.ts)
|
|
558
567
|
|
|
559
568
|
## Authors
|
|
560
569
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { IReset } from "@thi.ng/api";
|
|
2
2
|
import { AGen } from "./agen";
|
|
3
3
|
/**
|
|
4
|
-
* Creates a new `Add` gen using given `step` (default: 1) and `start
|
|
5
|
-
* (default: 0) values, producing: `y(t) = step + y(t-1)`.
|
|
4
|
+
* Creates a new `Add` gen using given `step` (default: 1.0) and `start`
|
|
5
|
+
* (default: 0.0) values, producing: `y(t) = step + y(t-1)`. If `clamp` is
|
|
6
|
+
* given, the resulting output will be clamped to that value (min or max depends
|
|
7
|
+
* on sign of `start - clamp`).
|
|
6
8
|
*
|
|
7
9
|
* @param step
|
|
8
10
|
* @param start
|
package/{gen/add.js → add.js}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AGen } from "./agen";
|
|
2
2
|
/**
|
|
3
|
-
* Creates a new `Add` gen using given `step` (default: 1) and `start
|
|
4
|
-
* (default: 0) values, producing: `y(t) = step + y(t-1)`.
|
|
3
|
+
* Creates a new `Add` gen using given `step` (default: 1.0) and `start`
|
|
4
|
+
* (default: 0.0) values, producing: `y(t) = step + y(t-1)`. If `clamp` is
|
|
5
|
+
* given, the resulting output will be clamped to that value (min or max depends
|
|
6
|
+
* on sign of `start - clamp`).
|
|
5
7
|
*
|
|
6
8
|
* @param step
|
|
7
9
|
* @param start
|
|
@@ -9,6 +11,9 @@ import { AGen } from "./agen";
|
|
|
9
11
|
*/
|
|
10
12
|
export const add = (step, start, clamp) => new Add(step, start, clamp);
|
|
11
13
|
export class Add extends AGen {
|
|
14
|
+
_step;
|
|
15
|
+
_start;
|
|
16
|
+
_clamp;
|
|
12
17
|
constructor(_step = 1, _start = 0, _clamp) {
|
|
13
18
|
super(0);
|
|
14
19
|
this._step = _step;
|
package/{comp/addg.js → addg.js}
RENAMED
|
File without changes
|
package/{gen/adsr.js → adsr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clamp01 } from "@thi.ng/math";
|
|
1
|
+
import { clamp01 } from "@thi.ng/math/interval";
|
|
2
2
|
import { add } from "./add";
|
|
3
3
|
import { AGen } from "./agen";
|
|
4
4
|
import { curve } from "./curve";
|
|
@@ -36,9 +36,29 @@ var EnvPhase;
|
|
|
36
36
|
*/
|
|
37
37
|
export const adsr = (opts) => new ADSR(opts);
|
|
38
38
|
export class ADSR extends AGen {
|
|
39
|
+
_phase;
|
|
40
|
+
_curve;
|
|
41
|
+
_atime;
|
|
42
|
+
_dtime;
|
|
43
|
+
_rtime;
|
|
44
|
+
_acurve;
|
|
45
|
+
_dcurve;
|
|
46
|
+
_sustain;
|
|
47
|
+
_speriod;
|
|
48
|
+
_gain;
|
|
39
49
|
constructor(opts) {
|
|
40
50
|
super(0);
|
|
41
|
-
opts =
|
|
51
|
+
opts = {
|
|
52
|
+
a: 0,
|
|
53
|
+
d: 0,
|
|
54
|
+
s: 1,
|
|
55
|
+
r: 0,
|
|
56
|
+
acurve: 0.1,
|
|
57
|
+
dcurve: 0.001,
|
|
58
|
+
slen: Infinity,
|
|
59
|
+
gain: 1,
|
|
60
|
+
...opts,
|
|
61
|
+
};
|
|
42
62
|
this.setAttack(opts.a);
|
|
43
63
|
this.setDecay(opts.d);
|
|
44
64
|
this.setRelease(opts.r);
|
package/{gen/agen.js → agen.js}
RENAMED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { __take } from "./internal/take";
|
|
1
2
|
/**
|
|
2
3
|
* Abstract base class for unit gens in this package. Provides
|
|
3
4
|
* {@link @thi.ng/api#IDeref} to obtain the gen's current value and
|
|
4
5
|
* `Iterable` implementations to use gens as ES6 iterables.
|
|
5
6
|
*/
|
|
6
7
|
export class AGen {
|
|
8
|
+
_val;
|
|
7
9
|
constructor(_val) {
|
|
8
10
|
this._val = _val;
|
|
9
11
|
}
|
|
@@ -15,9 +17,6 @@ export class AGen {
|
|
|
15
17
|
yield this.next();
|
|
16
18
|
}
|
|
17
19
|
take(num, out = [], idx = 0) {
|
|
18
|
-
|
|
19
|
-
out[idx++] = this.next();
|
|
20
|
-
}
|
|
21
|
-
return out;
|
|
20
|
+
return __take(this, num, out, idx);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
package/{gen/alt.js → alt.js}
RENAMED
|
@@ -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
|