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