@thi.ng/dsp 4.3.8 → 4.3.10
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/README.md +1 -1
- package/adsr.js +13 -13
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/adsr.js
CHANGED
|
@@ -59,54 +59,54 @@ export class ADSR extends AGen {
|
|
|
59
59
|
this.reset();
|
|
60
60
|
}
|
|
61
61
|
reset() {
|
|
62
|
-
this._phase =
|
|
62
|
+
this._phase = EnvPhase.ATTACK;
|
|
63
63
|
this._curve = curve(0, 1, this._atime + 1, this._acurve, true);
|
|
64
64
|
this._val = 0;
|
|
65
65
|
return this;
|
|
66
66
|
}
|
|
67
67
|
release() {
|
|
68
|
-
if (this._phase <
|
|
69
|
-
this._phase =
|
|
68
|
+
if (this._phase < EnvPhase.RELEASE) {
|
|
69
|
+
this._phase = EnvPhase.RELEASE;
|
|
70
70
|
this._curve = curve(this._sustain, 0, this._rtime + 1, this._dcurve, true);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
isSustained() {
|
|
74
|
-
return this._phase ===
|
|
74
|
+
return this._phase === EnvPhase.SUSTAIN;
|
|
75
75
|
}
|
|
76
76
|
isDone() {
|
|
77
|
-
return this._phase ===
|
|
77
|
+
return this._phase === EnvPhase.IDLE;
|
|
78
78
|
}
|
|
79
79
|
next() {
|
|
80
80
|
let v;
|
|
81
81
|
switch (this._phase) {
|
|
82
|
-
case
|
|
82
|
+
case EnvPhase.IDLE:
|
|
83
83
|
return 0;
|
|
84
|
-
case
|
|
84
|
+
case EnvPhase.ATTACK:
|
|
85
85
|
v = this._curve.next();
|
|
86
86
|
if (v >= 1) {
|
|
87
87
|
v = 1;
|
|
88
|
-
this._phase =
|
|
88
|
+
this._phase = EnvPhase.DECAY;
|
|
89
89
|
this._curve = curve(1, this._sustain, this._dtime + 1, this._dcurve, true);
|
|
90
90
|
}
|
|
91
91
|
break;
|
|
92
|
-
case
|
|
92
|
+
case EnvPhase.DECAY:
|
|
93
93
|
v = this._curve.next();
|
|
94
94
|
if (v <= this._sustain) {
|
|
95
95
|
v = this._sustain;
|
|
96
|
-
this._phase =
|
|
96
|
+
this._phase = EnvPhase.SUSTAIN;
|
|
97
97
|
this._curve = add(1, 1);
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
|
-
case
|
|
100
|
+
case EnvPhase.SUSTAIN:
|
|
101
101
|
if (this._curve.next() >= this._speriod) {
|
|
102
102
|
this.release();
|
|
103
103
|
}
|
|
104
104
|
return this._val;
|
|
105
|
-
case
|
|
105
|
+
case EnvPhase.RELEASE:
|
|
106
106
|
v = this._curve.next();
|
|
107
107
|
if (v < 0) {
|
|
108
108
|
v = 0;
|
|
109
|
-
this._phase =
|
|
109
|
+
this._phase = EnvPhase.IDLE;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
return (this._val = v * this._gain);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/dsp",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.10",
|
|
4
4
|
"description": "Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.7.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/errors": "^2.2.
|
|
40
|
-
"@thi.ng/math": "^5.4.
|
|
41
|
-
"@thi.ng/random": "^3.3.
|
|
42
|
-
"@thi.ng/transducers": "^8.
|
|
37
|
+
"@thi.ng/api": "^8.7.5",
|
|
38
|
+
"@thi.ng/checks": "^3.3.11",
|
|
39
|
+
"@thi.ng/errors": "^2.2.14",
|
|
40
|
+
"@thi.ng/math": "^5.4.6",
|
|
41
|
+
"@thi.ng/random": "^3.3.28",
|
|
42
|
+
"@thi.ng/transducers": "^8.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "^7.34.4",
|
|
46
|
-
"@thi.ng/testament": "^0.3.
|
|
47
|
-
"rimraf": "^4.4.
|
|
46
|
+
"@thi.ng/testament": "^0.3.14",
|
|
47
|
+
"rimraf": "^4.4.1",
|
|
48
48
|
"tools": "^0.0.1",
|
|
49
|
-
"typedoc": "^0.23.
|
|
50
|
-
"typescript": "^
|
|
49
|
+
"typedoc": "^0.23.28",
|
|
50
|
+
"typescript": "^5.0.2"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"allpass",
|
|
@@ -275,5 +275,5 @@
|
|
|
275
275
|
],
|
|
276
276
|
"year": 2015
|
|
277
277
|
},
|
|
278
|
-
"gitHead": "
|
|
278
|
+
"gitHead": "83b15b34326d480cbca0472b20390d4d3bbb792a\n"
|
|
279
279
|
}
|