@logue/reverb 1.3.7 → 1.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/dist/Reverb.es.js CHANGED
@@ -3,71 +3,19 @@
3
3
  *
4
4
  * @description JavaScript Reverb effect class
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2019-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.7
8
+ * @version 1.3.10
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
12
- const g = 23283064365386963e-26;
13
- class F {
14
- float(e = 1) {
15
- return this.int() * g * e;
16
- }
17
- probability(e) {
18
- return this.float() < e;
19
- }
20
- norm(e = 1) {
21
- return (this.int() * g - 0.5) * 2 * e;
22
- }
23
- normMinMax(e, s) {
24
- const i = this.minmax(e, s);
25
- return this.float() < 0.5 ? i : -i;
26
- }
27
- minmax(e, s) {
28
- return this.float() * (s - e) + e;
29
- }
30
- minmaxInt(e, s) {
31
- e |= 0;
32
- const i = (s | 0) - e;
33
- return i ? e + this.int() % i : e;
34
- }
35
- minmaxUint(e, s) {
36
- e >>>= 0;
37
- const i = (s >>> 0) - e;
38
- return i ? e + this.int() % i : e;
39
- }
40
- }
41
- const m = Math.random;
42
- class T extends F {
43
- int() {
44
- return m() * 4294967296 >>> 0;
45
- }
46
- float(e = 1) {
47
- return m() * e;
48
- }
49
- norm(e = 1) {
50
- return (m() - 0.5) * 2 * e;
51
- }
52
- }
53
- const k = new T(), x = {
54
- noise: "white",
55
- scale: 1,
56
- peaks: 2,
57
- randomAlgorithm: k,
58
- decay: 2,
59
- delay: 0,
60
- reverse: !1,
61
- time: 2,
62
- filterType: "allpass",
63
- filterFreq: 2200,
64
- filterQ: 1,
65
- mix: 0.5,
66
- once: !1
67
- }, w = {
68
- version: "1.3.7",
69
- date: "2024-01-29T10:30:54.595Z"
70
- }, d = {
12
+ import { white as c, violet as m, red as f, pink as b, green as N, blue as g } from "@thi.ng/colored-noise";
13
+ import { take as v } from "@thi.ng/transducers";
14
+ import { SYSTEM as w } from "@thi.ng/random";
15
+ const d = {
16
+ version: "1.3.10",
17
+ date: "2024-08-10T17:32:59.823Z"
18
+ }, o = {
71
19
  /** Blue noise */
72
20
  blue: "blue",
73
21
  /** Brown noise (same as red noise) */
@@ -82,112 +30,26 @@ const k = new T(), x = {
82
30
  violet: "violet",
83
31
  /** White noise */
84
32
  white: "white"
85
- }, p = {
86
- bins: 2,
33
+ }, y = {
34
+ noise: "white",
87
35
  scale: 1,
88
- rnd: k
89
- }, N = (t, e, s) => {
90
- const i = new Array(t);
91
- for (let n = 0; n < t; n++)
92
- i[n] = s.norm(e);
93
- return i;
94
- }, v = (t) => t.reduce((e, s) => e + s, 0);
95
- function* G(t, e) {
96
- const s = [t[Symbol.iterator](), e[Symbol.iterator]()];
97
- for (let i = 0; ; i ^= 1) {
98
- const n = s[i].next();
99
- if (n.done)
100
- return;
101
- yield n.value;
102
- }
103
- }
104
- function* b(t) {
105
- const { bins: e, scale: s, rnd: i } = {
106
- ...p,
107
- ...t
108
- }, n = N(e, s, i);
109
- n.forEach((r, l) => n[l] = l & 1 ? r : -r);
110
- const a = 1 / e;
111
- let o = v(n);
112
- for (let r = 0, l = -1; ; ++r >= e && (r = 0))
113
- o -= n[r], o += n[r] = l * i.norm(s), l ^= 4294967294, yield l * o * a;
114
- }
115
- const C = (t) => G(b(t), b(t)), E = (t) => {
116
- let e = 32;
117
- return t &= -t, t && e--, t & 65535 && (e -= 16), t & 16711935 && (e -= 8), t & 252645135 && (e -= 4), t & 858993459 && (e -= 2), t & 1431655765 && (e -= 1), e;
36
+ peaks: 2,
37
+ randomAlgorithm: w,
38
+ decay: 2,
39
+ delay: 0,
40
+ reverse: !1,
41
+ time: 2,
42
+ filterType: "allpass",
43
+ filterFreq: 2200,
44
+ filterQ: 1,
45
+ mix: 0.5,
46
+ once: !1
118
47
  };
119
- function* j(t) {
120
- const { bins: e, scale: s, rnd: i } = {
121
- ...p,
122
- bins: 8,
123
- ...t
124
- }, n = N(e, s, i), a = 1 / e;
125
- let o = v(n);
126
- for (let r = 0; ; r = r + 1 >>> 0) {
127
- const l = E(r) % e;
128
- o -= n[l], o += n[l] = i.norm(s), yield o * a;
129
- }
130
- }
131
- function* y(t) {
132
- const { bins: e, scale: s, rnd: i } = {
133
- ...p,
134
- ...t
135
- }, n = N(e, s, i), a = 1 / e;
136
- let o = v(n);
137
- for (let r = 0; ; ++r >= e && (r = 0))
138
- o -= n[r], o += n[r] = i.norm(s), yield o * a;
139
- }
140
- const M = (t) => G(y(t), y(t));
141
- function* R(t) {
142
- const { scale: e, rnd: s } = { ...p, ...t };
143
- for (; ; )
144
- yield s.norm(e);
145
- }
146
- const S = (t, e) => t != null && typeof t[e] == "function", Q = (t) => S(t, "xform") ? t.xform() : t, q = (t) => t != null && typeof t[Symbol.iterator] == "function";
147
- class u {
148
- value;
149
- constructor(e) {
150
- this.value = e;
151
- }
152
- deref() {
153
- return this.value;
154
- }
155
- }
156
- const D = (t) => new u(t), L = (t) => t instanceof u, B = (t) => t instanceof u ? t : new u(t), I = (t) => t instanceof u ? t.deref() : t, O = (t, e) => [t, (s) => s, e];
157
- function U(t) {
158
- return t ? [...t] : O(
159
- () => [],
160
- (e, s) => (e.push(s), e)
161
- );
162
- }
163
- function* z(t, e) {
164
- const s = Q(t)(U()), i = s[1], n = s[2];
165
- for (let a of e) {
166
- const o = n([], a);
167
- if (L(o)) {
168
- yield* I(i(o.deref()));
169
- return;
170
- }
171
- o.length && (yield* o);
172
- }
173
- yield* I(i([]));
174
- }
175
- const P = (t, e) => [t[0], t[1], e];
176
- function A(t, e) {
177
- return q(e) ? z(A(t), e) : (s) => {
178
- const i = s[2];
179
- let n = t;
180
- return P(
181
- s,
182
- (a, o) => --n > 0 ? i(a, o) : n === 0 ? B(i(a, o)) : D(a)
183
- );
184
- };
185
- }
186
- class h {
48
+ class s {
187
49
  /** Version strings */
188
- static version = w.version;
50
+ static version = d.version;
189
51
  /** Build date */
190
- static build = w.date;
52
+ static build = d.date;
191
53
  /** AudioContext */
192
54
  ctx;
193
55
  /** Wet Level (Reverberated node) */
@@ -205,15 +67,15 @@ class h {
205
67
  /** Connected flag */
206
68
  isConnected;
207
69
  /** Noise Generator */
208
- noise = R;
70
+ noise = c;
209
71
  /**
210
72
  * Constructor
211
73
  *
212
74
  * @param ctx - Root AudioContext
213
75
  * @param options - Configure
214
76
  */
215
- constructor(e, s) {
216
- this.ctx = e, this.options = Object.assign(x, s), this.wetGainNode = this.ctx.createGain(), this.dryGainNode = this.ctx.createGain(), this.filterNode = this.ctx.createBiquadFilter(), this.convolverNode = this.ctx.createConvolver(), this.outputNode = this.ctx.createGain(), this.isConnected = !1, this.filterType(this.options.filterType), this.setNoise(this.options.noise), this.buildImpulse(), this.mix(this.options.mix);
77
+ constructor(e, t) {
78
+ this.ctx = e, this.options = Object.assign(y, t), this.wetGainNode = this.ctx.createGain(), this.dryGainNode = this.ctx.createGain(), this.filterNode = this.ctx.createBiquadFilter(), this.convolverNode = this.ctx.createConvolver(), this.outputNode = this.ctx.createGain(), this.isConnected = !1, this.filterType(this.options.filterType), this.setNoise(this.options.noise), this.buildImpulse(), this.mix(this.options.mix);
217
79
  }
218
80
  /**
219
81
  * Connect the node for the reverb effect to the original sound node.
@@ -237,7 +99,7 @@ class h {
237
99
  * @param mix - Ratio (0~1)
238
100
  */
239
101
  mix(e) {
240
- if (!h.inRange(e, 0, 1))
102
+ if (!s.inRange(e, 0, 1))
241
103
  throw new RangeError("[Reverb.js] Dry/Wet ratio must be between 0 to 1.");
242
104
  this.options.mix = e, this.dryGainNode.gain.value = 1 - this.options.mix, this.wetGainNode.gain.value = this.options.mix;
243
105
  }
@@ -247,7 +109,7 @@ class h {
247
109
  * @param value - IR length
248
110
  */
249
111
  time(e) {
250
- if (!h.inRange(e, 1, 50))
112
+ if (!s.inRange(e, 1, 50))
251
113
  throw new RangeError(
252
114
  "[Reverb.js] Time length of inpulse response must be less than 50sec."
253
115
  );
@@ -259,7 +121,7 @@ class h {
259
121
  * @param value - Decay value
260
122
  */
261
123
  decay(e) {
262
- if (!h.inRange(e, 0, 100))
124
+ if (!s.inRange(e, 0, 100))
263
125
  throw new RangeError(
264
126
  "[Reverb.js] Inpulse Response decay level must be less than 100."
265
127
  );
@@ -271,7 +133,7 @@ class h {
271
133
  * @param value - Time[ms]
272
134
  */
273
135
  delay(e) {
274
- if (!h.inRange(e, 0, 100))
136
+ if (!s.inRange(e, 0, 100))
275
137
  throw new RangeError(
276
138
  "[Reverb.js] Inpulse Response delay time must be less than 100."
277
139
  );
@@ -299,7 +161,7 @@ class h {
299
161
  * @param freq - Frequency
300
162
  */
301
163
  filterFreq(e) {
302
- if (!h.inRange(e, 20, 2e4))
164
+ if (!s.inRange(e, 20, 2e4))
303
165
  throw new RangeError(
304
166
  "[Reverb.js] Filter frequrncy must be between 20 and 20000."
305
167
  );
@@ -311,7 +173,7 @@ class h {
311
173
  * @param q - Quality
312
174
  */
313
175
  filterQ(e) {
314
- if (!h.inRange(e, 0, 10))
176
+ if (!s.inRange(e, 0, 10))
315
177
  throw new RangeError(
316
178
  "[Reverb.js] Filter Q value must be between 0 and 10."
317
179
  );
@@ -348,24 +210,24 @@ class h {
348
210
  */
349
211
  setNoise(e) {
350
212
  switch (this.options.noise = e, e) {
351
- case d.blue:
352
- this.noise = b;
213
+ case o.blue:
214
+ this.noise = g;
353
215
  break;
354
- case d.green:
355
- this.noise = C;
216
+ case o.green:
217
+ this.noise = N;
356
218
  break;
357
- case d.pink:
358
- this.noise = j;
219
+ case o.pink:
220
+ this.noise = b;
359
221
  break;
360
- case d.red:
361
- case d.brown:
362
- this.noise = y;
222
+ case o.red:
223
+ case o.brown:
224
+ this.noise = f;
363
225
  break;
364
- case d.violet:
365
- this.noise = M;
226
+ case o.violet:
227
+ this.noise = m;
366
228
  break;
367
229
  default:
368
- this.noise = R;
230
+ this.noise = c;
369
231
  }
370
232
  this.buildImpulse();
371
233
  }
@@ -384,17 +246,17 @@ class h {
384
246
  * @param min - Minimum value
385
247
  * @param max - Maximum value
386
248
  */
387
- static inRange(e, s, i) {
388
- return (e - s) * (e - i) <= 0;
249
+ static inRange(e, t, n) {
250
+ return (e - t) * (e - n) <= 0;
389
251
  }
390
252
  /** Utility function for building an impulse response from the module parameters. */
391
253
  buildImpulse() {
392
- const e = this.ctx.sampleRate, s = Math.max(e * this.options.time, 1), i = e * this.options.delay, n = this.ctx.createBuffer(2, s, e), a = new Float32Array(s), o = new Float32Array(s), r = this.getNoise(s), l = this.getNoise(s);
393
- for (let c = 0; c < s; c++) {
394
- let f = 0;
395
- c < i ? (a[c] = 0, o[c] = 0, f = this.options.reverse ?? !1 ? s - (c - i) : c - i) : f = this.options.reverse ?? !1 ? s - c : c, a[c] = (r[c] ?? 0) * (1 - f / s) ** this.options.decay, o[c] = (l[c] ?? 0) * (1 - f / s) ** this.options.decay;
254
+ const e = this.ctx.sampleRate, t = Math.max(e * this.options.time, 1), n = e * this.options.delay, a = this.ctx.createBuffer(2, t, e), h = new Float32Array(t), l = new Float32Array(t), p = this.getNoise(t), u = this.getNoise(t);
255
+ for (let i = 0; i < t; i++) {
256
+ let r = 0;
257
+ i < n ? (h[i] = 0, l[i] = 0, r = this.options.reverse ?? !1 ? t - (i - n) : i - n) : r = this.options.reverse ?? !1 ? t - i : i, h[i] = (p[i] ?? 0) * (1 - r / t) ** this.options.decay, l[i] = (u[i] ?? 0) * (1 - r / t) ** this.options.decay;
396
258
  }
397
- n.getChannelData(0).set(a), n.getChannelData(1).set(o), this.convolverNode.buffer = n;
259
+ a.getChannelData(0).set(h), a.getChannelData(1).set(l), this.convolverNode.buffer = a;
398
260
  }
399
261
  /**
400
262
  * Noise source
@@ -403,7 +265,7 @@ class h {
403
265
  */
404
266
  getNoise(e) {
405
267
  return [
406
- ...A(
268
+ ...v(
407
269
  e,
408
270
  this.noise({
409
271
  bins: this.options.peaks,
@@ -415,5 +277,5 @@ class h {
415
277
  }
416
278
  }
417
279
  export {
418
- h as default
280
+ s as default
419
281
  };
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * @description JavaScript Reverb effect class
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2019-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.7
8
+ * @version 1.3.10
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
12
- var Reverb=function(){"use strict";const g=23283064365386963e-26;class F{float(e=1){return this.int()*g*e}probability(e){return this.float()<e}norm(e=1){return(this.int()*g-.5)*2*e}normMinMax(e,s){const i=this.minmax(e,s);return this.float()<.5?i:-i}minmax(e,s){return this.float()*(s-e)+e}minmaxInt(e,s){e|=0;const i=(s|0)-e;return i?e+this.int()%i:e}minmaxUint(e,s){e>>>=0;const i=(s>>>0)-e;return i?e+this.int()%i:e}}const m=Math.random;class T extends F{int(){return m()*4294967296>>>0}float(e=1){return m()*e}norm(e=1){return(m()-.5)*2*e}}const w=new T,C={noise:"white",scale:1,peaks:2,randomAlgorithm:w,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1},R={version:"1.3.7",date:"2024-01-29T10:30:54.595Z"},u={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},f={bins:2,scale:1,rnd:w},b=(t,e,s)=>{const i=new Array(t);for(let n=0;n<t;n++)i[n]=s.norm(e);return i},y=t=>t.reduce((e,s)=>e+s,0);function*I(t,e){const s=[t[Symbol.iterator](),e[Symbol.iterator]()];for(let i=0;;i^=1){const n=s[i].next();if(n.done)return;yield n.value}}function*v(t){const{bins:e,scale:s,rnd:i}={...f,...t},n=b(e,s,i);n.forEach((r,l)=>n[l]=l&1?r:-r);const c=1/e;let o=y(n);for(let r=0,l=-1;;++r>=e&&(r=0))o-=n[r],o+=n[r]=l*i.norm(s),l^=4294967294,yield l*o*c}const x=t=>I(v(t),v(t)),E=t=>{let e=32;return t&=-t,t&&e--,t&65535&&(e-=16),t&16711935&&(e-=8),t&252645135&&(e-=4),t&858993459&&(e-=2),t&1431655765&&(e-=1),e};function*j(t){const{bins:e,scale:s,rnd:i}={...f,bins:8,...t},n=b(e,s,i),c=1/e;let o=y(n);for(let r=0;;r=r+1>>>0){const l=E(r)%e;o-=n[l],o+=n[l]=i.norm(s),yield o*c}}function*N(t){const{bins:e,scale:s,rnd:i}={...f,...t},n=b(e,s,i),c=1/e;let o=y(n);for(let r=0;;++r>=e&&(r=0))o-=n[r],o+=n[r]=i.norm(s),yield o*c}const M=t=>I(N(t),N(t));function*k(t){const{scale:e,rnd:s}={...f,...t};for(;;)yield s.norm(e)}const S=(t,e)=>t!=null&&typeof t[e]=="function",Q=t=>S(t,"xform")?t.xform():t,q=t=>t!=null&&typeof t[Symbol.iterator]=="function";class d{value;constructor(e){this.value=e}deref(){return this.value}}const D=t=>new d(t),L=t=>t instanceof d,B=t=>t instanceof d?t:new d(t),G=t=>t instanceof d?t.deref():t,O=(t,e)=>[t,s=>s,e];function U(t){return t?[...t]:O(()=>[],(e,s)=>(e.push(s),e))}function*z(t,e){const s=Q(t)(U()),i=s[1],n=s[2];for(let c of e){const o=n([],c);if(L(o)){yield*G(i(o.deref()));return}o.length&&(yield*o)}yield*G(i([]))}const P=(t,e)=>[t[0],t[1],e];function A(t,e){return q(e)?z(A(t),e):s=>{const i=s[2];let n=t;return P(s,(c,o)=>--n>0?i(c,o):n===0?B(i(c,o)):D(c))}}class h{static version=R.version;static build=R.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=k;constructor(e,s){this.ctx=e,this.options=Object.assign(C,s),this.wetGainNode=this.ctx.createGain(),this.dryGainNode=this.ctx.createGain(),this.filterNode=this.ctx.createBiquadFilter(),this.convolverNode=this.ctx.createConvolver(),this.outputNode=this.ctx.createGain(),this.isConnected=!1,this.filterType(this.options.filterType),this.setNoise(this.options.noise),this.buildImpulse(),this.mix(this.options.mix)}connect(e){return this.isConnected&&this.options.once?(this.isConnected=!1,this.outputNode):(this.convolverNode.connect(this.filterNode),this.filterNode.connect(this.wetGainNode),e.connect(this.convolverNode),e.connect(this.dryGainNode).connect(this.outputNode),e.connect(this.wetGainNode).connect(this.outputNode),this.isConnected=!0,this.outputNode)}disconnect(e){return this.isConnected&&(this.convolverNode.disconnect(this.filterNode),this.filterNode.disconnect(this.wetGainNode)),this.isConnected=!1,e}mix(e){if(!h.inRange(e,0,1))throw new RangeError("[Reverb.js] Dry/Wet ratio must be between 0 to 1.");this.options.mix=e,this.dryGainNode.gain.value=1-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!h.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of inpulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!h.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!h.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response delay time must be less than 100.");this.options.delay=e,this.buildImpulse()}reverse(e){this.options.reverse=e,this.buildImpulse()}filterType(e="allpass"){this.filterNode.type=this.options.filterType=e}filterFreq(e){if(!h.inRange(e,20,2e4))throw new RangeError("[Reverb.js] Filter frequrncy must be between 20 and 20000.");this.options.filterFreq=e,this.filterNode.frequency.value=this.options.filterFreq}filterQ(e){if(!h.inRange(e,0,10))throw new RangeError("[Reverb.js] Filter Q value must be between 0 and 10.");this.options.filterQ=e,this.filterNode.Q.value=this.options.filterQ}peaks(e){this.options.peaks=e,this.buildImpulse()}scale(e){this.options.scale=e,this.buildImpulse()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case u.blue:this.noise=v;break;case u.green:this.noise=x;break;case u.pink:this.noise=j;break;case u.red:case u.brown:this.noise=N;break;case u.violet:this.noise=M;break;default:this.noise=k}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,s,i){return(e-s)*(e-i)<=0}buildImpulse(){const e=this.ctx.sampleRate,s=Math.max(e*this.options.time,1),i=e*this.options.delay,n=this.ctx.createBuffer(2,s,e),c=new Float32Array(s),o=new Float32Array(s),r=this.getNoise(s),l=this.getNoise(s);for(let a=0;a<s;a++){let p=0;a<i?(c[a]=0,o[a]=0,p=this.options.reverse??!1?s-(a-i):a-i):p=this.options.reverse??!1?s-a:a,c[a]=(r[a]??0)*(1-p/s)**this.options.decay,o[a]=(l[a]??0)*(1-p/s)**this.options.decay}n.getChannelData(0).set(c),n.getChannelData(1).set(o),this.convolverNode.buffer=n}getNoise(e){return[...A(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return h}();
12
+ var Reverb=function(n,p,u){"use strict";const d={version:"1.3.10",date:"2024-08-10T17:32:59.823Z"},o={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},f={noise:"white",scale:1,peaks:2,randomAlgorithm:u.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class s{static version=d.version;static build=d.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=n.white;constructor(e,t){this.ctx=e,this.options=Object.assign(f,t),this.wetGainNode=this.ctx.createGain(),this.dryGainNode=this.ctx.createGain(),this.filterNode=this.ctx.createBiquadFilter(),this.convolverNode=this.ctx.createConvolver(),this.outputNode=this.ctx.createGain(),this.isConnected=!1,this.filterType(this.options.filterType),this.setNoise(this.options.noise),this.buildImpulse(),this.mix(this.options.mix)}connect(e){return this.isConnected&&this.options.once?(this.isConnected=!1,this.outputNode):(this.convolverNode.connect(this.filterNode),this.filterNode.connect(this.wetGainNode),e.connect(this.convolverNode),e.connect(this.dryGainNode).connect(this.outputNode),e.connect(this.wetGainNode).connect(this.outputNode),this.isConnected=!0,this.outputNode)}disconnect(e){return this.isConnected&&(this.convolverNode.disconnect(this.filterNode),this.filterNode.disconnect(this.wetGainNode)),this.isConnected=!1,e}mix(e){if(!s.inRange(e,0,1))throw new RangeError("[Reverb.js] Dry/Wet ratio must be between 0 to 1.");this.options.mix=e,this.dryGainNode.gain.value=1-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!s.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of inpulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!s.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!s.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response delay time must be less than 100.");this.options.delay=e,this.buildImpulse()}reverse(e){this.options.reverse=e,this.buildImpulse()}filterType(e="allpass"){this.filterNode.type=this.options.filterType=e}filterFreq(e){if(!s.inRange(e,20,2e4))throw new RangeError("[Reverb.js] Filter frequrncy must be between 20 and 20000.");this.options.filterFreq=e,this.filterNode.frequency.value=this.options.filterFreq}filterQ(e){if(!s.inRange(e,0,10))throw new RangeError("[Reverb.js] Filter Q value must be between 0 and 10.");this.options.filterQ=e,this.filterNode.Q.value=this.options.filterQ}peaks(e){this.options.peaks=e,this.buildImpulse()}scale(e){this.options.scale=e,this.buildImpulse()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case o.blue:this.noise=n.blue;break;case o.green:this.noise=n.green;break;case o.pink:this.noise=n.pink;break;case o.red:case o.brown:this.noise=n.red;break;case o.violet:this.noise=n.violet;break;default:this.noise=n.white}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,r){return(e-t)*(e-r)<=0}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),r=e*this.options.delay,h=this.ctx.createBuffer(2,t,e),l=new Float32Array(t),c=new Float32Array(t),m=this.getNoise(t),b=this.getNoise(t);for(let i=0;i<t;i++){let a=0;i<r?(l[i]=0,c[i]=0,a=this.options.reverse??!1?t-(i-r):i-r):a=this.options.reverse??!1?t-i:i,l[i]=(m[i]??0)*(1-a/t)**this.options.decay,c[i]=(b[i]??0)*(1-a/t)**this.options.decay}h.getChannelData(0).set(l),h.getChannelData(1).set(c),this.convolverNode.buffer=h}getNoise(e){return[...p.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return s}(coloredNoise,transducers,random);
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * @description JavaScript Reverb effect class
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2019-2023 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.7
8
+ * @version 1.3.10
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
12
- (function(d,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(d=typeof globalThis<"u"?globalThis:d||self,d.Reverb=f())})(this,function(){"use strict";const d=23283064365386963e-26;class f{float(e=1){return this.int()*d*e}probability(e){return this.float()<e}norm(e=1){return(this.int()*d-.5)*2*e}normMinMax(e,s){const i=this.minmax(e,s);return this.float()<.5?i:-i}minmax(e,s){return this.float()*(s-e)+e}minmaxInt(e,s){e|=0;const i=(s|0)-e;return i?e+this.int()%i:e}minmaxUint(e,s){e>>>=0;const i=(s>>>0)-e;return i?e+this.int()%i:e}}const y=Math.random;class x extends f{int(){return y()*4294967296>>>0}float(e=1){return y()*e}norm(e=1){return(y()-.5)*2*e}}const R=new x,F={noise:"white",scale:1,peaks:2,randomAlgorithm:R,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1},I={version:"1.3.7",date:"2024-01-29T10:30:54.595Z"},u={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},m={bins:2,scale:1,rnd:R},v=(t,e,s)=>{const i=new Array(t);for(let n=0;n<t;n++)i[n]=s.norm(e);return i},N=t=>t.reduce((e,s)=>e+s,0);function*k(t,e){const s=[t[Symbol.iterator](),e[Symbol.iterator]()];for(let i=0;;i^=1){const n=s[i].next();if(n.done)return;yield n.value}}function*g(t){const{bins:e,scale:s,rnd:i}={...m,...t},n=v(e,s,i);n.forEach((r,a)=>n[a]=a&1?r:-r);const c=1/e;let o=N(n);for(let r=0,a=-1;;++r>=e&&(r=0))o-=n[r],o+=n[r]=a*i.norm(s),a^=4294967294,yield a*o*c}const C=t=>k(g(t),g(t)),E=t=>{let e=32;return t&=-t,t&&e--,t&65535&&(e-=16),t&16711935&&(e-=8),t&252645135&&(e-=4),t&858993459&&(e-=2),t&1431655765&&(e-=1),e};function*j(t){const{bins:e,scale:s,rnd:i}={...m,bins:8,...t},n=v(e,s,i),c=1/e;let o=N(n);for(let r=0;;r=r+1>>>0){const a=E(r)%e;o-=n[a],o+=n[a]=i.norm(s),yield o*c}}function*w(t){const{bins:e,scale:s,rnd:i}={...m,...t},n=v(e,s,i),c=1/e;let o=N(n);for(let r=0;;++r>=e&&(r=0))o-=n[r],o+=n[r]=i.norm(s),yield o*c}const M=t=>k(w(t),w(t));function*G(t){const{scale:e,rnd:s}={...m,...t};for(;;)yield s.norm(e)}const S=(t,e)=>t!=null&&typeof t[e]=="function",Q=t=>S(t,"xform")?t.xform():t,q=t=>t!=null&&typeof t[Symbol.iterator]=="function";class p{value;constructor(e){this.value=e}deref(){return this.value}}const D=t=>new p(t),L=t=>t instanceof p,B=t=>t instanceof p?t:new p(t),T=t=>t instanceof p?t.deref():t,O=(t,e)=>[t,s=>s,e];function U(t){return t?[...t]:O(()=>[],(e,s)=>(e.push(s),e))}function*z(t,e){const s=Q(t)(U()),i=s[1],n=s[2];for(let c of e){const o=n([],c);if(L(o)){yield*T(i(o.deref()));return}o.length&&(yield*o)}yield*T(i([]))}const P=(t,e)=>[t[0],t[1],e];function A(t,e){return q(e)?z(A(t),e):s=>{const i=s[2];let n=t;return P(s,(c,o)=>--n>0?i(c,o):n===0?B(i(c,o)):D(c))}}class h{static version=I.version;static build=I.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=G;constructor(e,s){this.ctx=e,this.options=Object.assign(F,s),this.wetGainNode=this.ctx.createGain(),this.dryGainNode=this.ctx.createGain(),this.filterNode=this.ctx.createBiquadFilter(),this.convolverNode=this.ctx.createConvolver(),this.outputNode=this.ctx.createGain(),this.isConnected=!1,this.filterType(this.options.filterType),this.setNoise(this.options.noise),this.buildImpulse(),this.mix(this.options.mix)}connect(e){return this.isConnected&&this.options.once?(this.isConnected=!1,this.outputNode):(this.convolverNode.connect(this.filterNode),this.filterNode.connect(this.wetGainNode),e.connect(this.convolverNode),e.connect(this.dryGainNode).connect(this.outputNode),e.connect(this.wetGainNode).connect(this.outputNode),this.isConnected=!0,this.outputNode)}disconnect(e){return this.isConnected&&(this.convolverNode.disconnect(this.filterNode),this.filterNode.disconnect(this.wetGainNode)),this.isConnected=!1,e}mix(e){if(!h.inRange(e,0,1))throw new RangeError("[Reverb.js] Dry/Wet ratio must be between 0 to 1.");this.options.mix=e,this.dryGainNode.gain.value=1-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!h.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of inpulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!h.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!h.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response delay time must be less than 100.");this.options.delay=e,this.buildImpulse()}reverse(e){this.options.reverse=e,this.buildImpulse()}filterType(e="allpass"){this.filterNode.type=this.options.filterType=e}filterFreq(e){if(!h.inRange(e,20,2e4))throw new RangeError("[Reverb.js] Filter frequrncy must be between 20 and 20000.");this.options.filterFreq=e,this.filterNode.frequency.value=this.options.filterFreq}filterQ(e){if(!h.inRange(e,0,10))throw new RangeError("[Reverb.js] Filter Q value must be between 0 and 10.");this.options.filterQ=e,this.filterNode.Q.value=this.options.filterQ}peaks(e){this.options.peaks=e,this.buildImpulse()}scale(e){this.options.scale=e,this.buildImpulse()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case u.blue:this.noise=g;break;case u.green:this.noise=C;break;case u.pink:this.noise=j;break;case u.red:case u.brown:this.noise=w;break;case u.violet:this.noise=M;break;default:this.noise=G}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,s,i){return(e-s)*(e-i)<=0}buildImpulse(){const e=this.ctx.sampleRate,s=Math.max(e*this.options.time,1),i=e*this.options.delay,n=this.ctx.createBuffer(2,s,e),c=new Float32Array(s),o=new Float32Array(s),r=this.getNoise(s),a=this.getNoise(s);for(let l=0;l<s;l++){let b=0;l<i?(c[l]=0,o[l]=0,b=this.options.reverse??!1?s-(l-i):l-i):b=this.options.reverse??!1?s-l:l,c[l]=(r[l]??0)*(1-b/s)**this.options.decay,o[l]=(a[l]??0)*(1-b/s)**this.options.decay}n.getChannelData(0).set(c),n.getChannelData(1).set(o),this.convolverNode.buffer=n}getNoise(e){return[...A(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return h});
12
+ (function(t,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("@thi.ng/colored-noise"),require("@thi.ng/transducers"),require("@thi.ng/random")):typeof define=="function"&&define.amd?define(["@thi.ng/colored-noise","@thi.ng/transducers","@thi.ng/random"],r):(t=typeof globalThis<"u"?globalThis:t||self,t.Reverb=r(t.coloredNoise,t.transducers,t.random))})(this,function(t,r,p){"use strict";const u={version:"1.3.10",date:"2024-08-10T17:32:59.823Z"},o={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},f={noise:"white",scale:1,peaks:2,randomAlgorithm:p.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class n{static version=u.version;static build=u.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=t.white;constructor(e,i){this.ctx=e,this.options=Object.assign(f,i),this.wetGainNode=this.ctx.createGain(),this.dryGainNode=this.ctx.createGain(),this.filterNode=this.ctx.createBiquadFilter(),this.convolverNode=this.ctx.createConvolver(),this.outputNode=this.ctx.createGain(),this.isConnected=!1,this.filterType(this.options.filterType),this.setNoise(this.options.noise),this.buildImpulse(),this.mix(this.options.mix)}connect(e){return this.isConnected&&this.options.once?(this.isConnected=!1,this.outputNode):(this.convolverNode.connect(this.filterNode),this.filterNode.connect(this.wetGainNode),e.connect(this.convolverNode),e.connect(this.dryGainNode).connect(this.outputNode),e.connect(this.wetGainNode).connect(this.outputNode),this.isConnected=!0,this.outputNode)}disconnect(e){return this.isConnected&&(this.convolverNode.disconnect(this.filterNode),this.filterNode.disconnect(this.wetGainNode)),this.isConnected=!1,e}mix(e){if(!n.inRange(e,0,1))throw new RangeError("[Reverb.js] Dry/Wet ratio must be between 0 to 1.");this.options.mix=e,this.dryGainNode.gain.value=1-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!n.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of inpulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!n.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!n.inRange(e,0,100))throw new RangeError("[Reverb.js] Inpulse Response delay time must be less than 100.");this.options.delay=e,this.buildImpulse()}reverse(e){this.options.reverse=e,this.buildImpulse()}filterType(e="allpass"){this.filterNode.type=this.options.filterType=e}filterFreq(e){if(!n.inRange(e,20,2e4))throw new RangeError("[Reverb.js] Filter frequrncy must be between 20 and 20000.");this.options.filterFreq=e,this.filterNode.frequency.value=this.options.filterFreq}filterQ(e){if(!n.inRange(e,0,10))throw new RangeError("[Reverb.js] Filter Q value must be between 0 and 10.");this.options.filterQ=e,this.filterNode.Q.value=this.options.filterQ}peaks(e){this.options.peaks=e,this.buildImpulse()}scale(e){this.options.scale=e,this.buildImpulse()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case o.blue:this.noise=t.blue;break;case o.green:this.noise=t.green;break;case o.pink:this.noise=t.pink;break;case o.red:case o.brown:this.noise=t.red;break;case o.violet:this.noise=t.violet;break;default:this.noise=t.white}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,i,h){return(e-i)*(e-h)<=0}buildImpulse(){const e=this.ctx.sampleRate,i=Math.max(e*this.options.time,1),h=e*this.options.delay,l=this.ctx.createBuffer(2,i,e),d=new Float32Array(i),c=new Float32Array(i),m=this.getNoise(i),b=this.getNoise(i);for(let s=0;s<i;s++){let a=0;s<h?(d[s]=0,c[s]=0,a=this.options.reverse??!1?i-(s-h):s-h):a=this.options.reverse??!1?i-s:s,d[s]=(m[s]??0)*(1-a/i)**this.options.decay,c[s]=(b[s]??0)*(1-a/i)**this.options.decay}l.getChannelData(0).set(d),l.getChannelData(1).set(c),this.convolverNode.buffer=l}getNoise(e){return[...r.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return n});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@logue/reverb",
4
- "version": "1.3.7",
4
+ "version": "1.3.10",
5
5
  "description": "JavaScript Reverb effect class",
6
6
  "keywords": [
7
7
  "webaudio",
@@ -40,10 +40,10 @@
40
40
  }
41
41
  },
42
42
  "engines": {
43
- "node": ">=18.12.5",
44
- "yarn": ">=1.22.19"
43
+ "node": ">=20.1.3",
44
+ "pnpm": ">=9.7.0"
45
45
  },
46
- "packageManager": "yarn@4.0.2",
46
+ "packageManager": "pnpm@9.7.0",
47
47
  "sideEffects": false,
48
48
  "scripts": {
49
49
  "dev": "vite",
@@ -59,36 +59,38 @@
59
59
  "prepare": "husky install"
60
60
  },
61
61
  "dependencies": {
62
- "@thi.ng/colored-noise": "^1.0.47",
63
- "@thi.ng/transducers": "^8.8.22"
62
+ "@thi.ng/colored-noise": "^1.0.78",
63
+ "@thi.ng/transducers": "^9.0.13"
64
64
  },
65
65
  "devDependencies": {
66
- "@tsconfig/node-lts": "^20.1.1",
67
- "@types/node": "^20.11.10",
68
- "@typescript-eslint/eslint-plugin": "^6.19.1",
69
- "bootstrap": "^5.3.2",
70
- "eslint": "^8.56.0",
66
+ "@eslint/js": "^9.9.0",
67
+ "@tsconfig/node-lts": "^20.1.3",
68
+ "@types/node": "^22.2.0",
69
+ "@typescript-eslint/eslint-plugin": "^8.0.1",
70
+ "bootstrap": "^5.3.3",
71
+ "eslint": "^9.9.0",
71
72
  "eslint-config-prettier": "^9.1.0",
72
73
  "eslint-config-standard-with-typescript": "^43.0.1",
73
74
  "eslint-import-resolver-alias": "^1.1.2",
74
75
  "eslint-import-resolver-typescript": "^3.6.1",
75
- "eslint-plugin-html": "^7.1.0",
76
+ "eslint-plugin-html": "^8.1.1",
76
77
  "eslint-plugin-import": "^2.29.1",
77
- "eslint-plugin-n": "^16.6.2",
78
- "eslint-plugin-promise": "^6.1.1",
79
- "eslint-plugin-tsdoc": "^0.2.17",
80
- "eslint-plugin-yaml": "^0.5.0",
81
- "husky": "^9.0.6",
82
- "lint-staged": "^15.2.0",
78
+ "eslint-plugin-n": "^17.10.2",
79
+ "eslint-plugin-promise": "^7.1.0",
80
+ "eslint-plugin-tsdoc": "^0.3.0",
81
+ "eslint-plugin-yaml": "^1.0.3",
82
+ "husky": "^9.1.4",
83
+ "lint-staged": "^15.2.8",
83
84
  "npm-run-all": "^4.1.5",
84
- "prettier": "^3.2.4",
85
- "rimraf": "^5.0.5",
85
+ "prettier": "^3.3.3",
86
+ "rimraf": "^6.0.1",
86
87
  "rollup-plugin-visualizer": "^5.12.0",
87
- "typescript": "latest",
88
- "vite": "^5.0.12",
88
+ "typescript": "^5.5.4",
89
+ "typescript-eslint": "^8.0.1",
90
+ "vite": "^5.4.0",
89
91
  "vite-plugin-banner": "^0.7.1",
90
- "vite-plugin-checker": "^0.6.2",
91
- "vite-plugin-dts": "^3.7.2"
92
+ "vite-plugin-checker": "^0.7.2",
93
+ "vite-plugin-dts": "^4.0.2"
92
94
  },
93
95
  "husky": {
94
96
  "hooks": {
@@ -100,10 +102,12 @@
100
102
  "*": "prettier -w -u"
101
103
  },
102
104
  "resolutions": {
103
- "json5": "^2.2.3",
105
+ "json5": ">=2.2.3",
106
+ "ip": ">=2.0.1",
104
107
  "lodash": ">=4.17.21",
105
- "postcss": "^8.4.31",
106
- "semver": "^7.5.3",
107
- "yaml": "^2.3.2"
108
+ "postcss": ">=8.4.31",
109
+ "semver": ">=7.5.3",
110
+ "tar": ">=6.2.1",
111
+ "yaml": ">=2.3.2"
108
112
  }
109
- }
113
+ }
package/dist/Reverb.d.ts DELETED
@@ -1,143 +0,0 @@
1
- import { type NoiseType } from './NoiseType';
2
- import type OptionInterface from './interfaces/OptionInterface';
3
- import type { INorm } from '@thi.ng/random';
4
- /**
5
- * Reverb effect class
6
- */
7
- export default class Reverb {
8
- /** Version strings */
9
- static version: string;
10
- /** Build date */
11
- static build: string;
12
- /** AudioContext */
13
- private readonly ctx;
14
- /** Wet Level (Reverberated node) */
15
- private readonly wetGainNode;
16
- /** Dry Level (Original sound node) */
17
- private readonly dryGainNode;
18
- /** Impulse response filter */
19
- private readonly filterNode;
20
- /** Convolution node for applying impulse response */
21
- private readonly convolverNode;
22
- /** Output gain node */
23
- private readonly outputNode;
24
- /** Option */
25
- private readonly options;
26
- /** Connected flag */
27
- private isConnected;
28
- /** Noise Generator */
29
- private noise;
30
- /**
31
- * Constructor
32
- *
33
- * @param ctx - Root AudioContext
34
- * @param options - Configure
35
- */
36
- constructor(ctx: AudioContext, options: Partial<OptionInterface>);
37
- /**
38
- * Connect the node for the reverb effect to the original sound node.
39
- *
40
- * @param sourceNode - Input source node
41
- */
42
- connect(sourceNode: AudioNode): AudioNode;
43
- /**
44
- * Disconnect the reverb node
45
- *
46
- * @param sourceNode - Input source node
47
- */
48
- disconnect(sourceNode?: AudioNode): AudioNode | undefined;
49
- /**
50
- * Dry/Wet ratio
51
- *
52
- * @param mix - Ratio (0~1)
53
- */
54
- mix(mix: number): void;
55
- /**
56
- * Set Impulse Response time length (second)
57
- *
58
- * @param value - IR length
59
- */
60
- time(value: number): void;
61
- /**
62
- * Impulse response decay rate.
63
- *
64
- * @param value - Decay value
65
- */
66
- decay(value: number): void;
67
- /**
68
- * Delay before reverberation starts
69
- *
70
- * @param value - Time[ms]
71
- */
72
- delay(value: number): void;
73
- /**
74
- * Reverse the impulse response.
75
- *
76
- * @param reverse - Reverse IR
77
- */
78
- reverse(reverse: boolean): void;
79
- /**
80
- * Filter for impulse response
81
- *
82
- * @param type - Filiter Type
83
- */
84
- filterType(type?: BiquadFilterType): void;
85
- /**
86
- * Filter frequency applied to impulse response
87
- *
88
- * @param freq - Frequency
89
- */
90
- filterFreq(freq: number): void;
91
- /**
92
- * Filter quality.
93
- *
94
- * @param q - Quality
95
- */
96
- filterQ(q: number): void;
97
- /**
98
- * set IR source noise peaks
99
- *
100
- * @param p - Peaks
101
- */
102
- peaks(p: number): void;
103
- /**
104
- * set IR source noise scale.
105
- *
106
- * @param s - Scale
107
- */
108
- scale(s: number): void;
109
- /**
110
- * set IR source noise generator.
111
- *
112
- * @param a - Algorithm
113
- */
114
- randomAlgorithm(a: INorm): void;
115
- /**
116
- * Inpulse Response Noise algorithm.
117
- *
118
- * @param type - IR noise algorithm type.
119
- */
120
- setNoise(type: NoiseType): void;
121
- /**
122
- * Set Random Algorythm
123
- *
124
- * @param algorithm - Algorythm
125
- */
126
- setRandomAlgorythm(algorithm: INorm): void;
127
- /**
128
- * Return true if in range, otherwise false
129
- *
130
- * @param x - Target value
131
- * @param min - Minimum value
132
- * @param max - Maximum value
133
- */
134
- private static inRange;
135
- /** Utility function for building an impulse response from the module parameters. */
136
- private buildImpulse;
137
- /**
138
- * Noise source
139
- *
140
- * @param duration - length of IR.
141
- */
142
- private getNoise;
143
- }