@logue/reverb 1.4.3 → 1.4.6
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/NoiseType.d.ts +2 -0
- package/dist/Reverb.cjs.js +3 -3
- package/dist/Reverb.d.ts +1 -1
- package/dist/Reverb.es.js +55 -30
- package/dist/Reverb.iife.js +3 -3
- package/dist/Reverb.umd.js +3 -3
- package/package.json +31 -24
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2019-
|
|
3
|
+
Copyright (c) 2019-2026 Masashi Yoshikawa <https://logue.dev>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
package/dist/NoiseType.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { ColoredNoiseOpts } from '@thi.ng/colored-noise';
|
|
1
2
|
/** Noise Type */
|
|
2
3
|
export type NoiseType = 'blue' | 'brown' | 'green' | 'pink' | 'red' | 'violet' | 'white';
|
|
4
|
+
export declare const NoiseType: Record<NoiseType, (opts?: Partial<ColoredNoiseOpts>) => Generator<number, void, unknown>>;
|
package/dist/Reverb.cjs.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description JavaScript Reverb effect class
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2019-
|
|
6
|
+
* @copyright 2019-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.4.
|
|
8
|
+
* @version 1.4.6
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@thi.ng/colored-noise"),
|
|
12
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@thi.ng/colored-noise"),m=require("@thi.ng/transducers"),b=require("@thi.ng/random");const p={version:"1.4.6",date:"2026-03-06T12:11:28.691Z"},N={blue:s.blue,brown:s.red,green:s.green,pink:s.pink,red:s.red,violet:s.violet,white:s.white},w={noise:"white",scale:1,peaks:2,randomAlgorithm:b.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class o{static version=p.version;static build=p.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=s.white;noiseMap=N;constructor(e,t){this.ctx=e,this.options=Object.assign({},w,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),e.connect(this.wetGainNode),this.dryGainNode.connect(this.outputNode),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(!o.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-e,this.wetGainNode.gain.value=e}time(e){if(!o.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of impulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!o.inRange(e,0,100))throw new RangeError("[Reverb.js] Impulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!o.inRange(e,0,100))throw new RangeError("[Reverb.js] Impulse 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(!o.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(!o.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()}getNoise(e){return[...m.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}setNoise(e){switch(this.options.noise=e,e){case"blue":this.noise=this.noiseMap.blue;break;case"brown":this.noise=this.noiseMap.brown;break;case"green":this.noise=this.noiseMap.green;break;case"pink":this.noise=this.noiseMap.pink;break;case"red":this.noise=this.noiseMap.red;break;case"violet":this.noise=this.noiseMap.violet;break;case"white":this.noise=this.noiseMap.white;break;default:this.noise=s.white;break}this.buildImpulse()}setRandomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,n){return e>=t&&e<=n}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),n=e*this.options.delay,l=this.ctx.createBuffer(2,t,e),c=new Float32Array(t),d=new Float32Array(t),r=new Float32Array(1),a=new Float32Array(1),u=this.getNoise(t),f=this.getNoise(t);for(let i=0;i<t;i++){let h;i<n?(r[0]=0,a[0]=0,c.set(r,i),d.set(a,i),h=this.options.reverse??!1?t-(i-n):i-n):h=this.options.reverse??!1?t-i:i,r[0]=(u.at(i)??0)*(1-h/t)**this.options.decay,a[0]=(f.at(i)??0)*(1-h/t)**this.options.decay,c.set(r,i),d.set(a,i)}l.getChannelData(0).set(c),l.getChannelData(1).set(d),this.convolverNode.buffer=l}}exports.default=o;
|
package/dist/Reverb.d.ts
CHANGED
package/dist/Reverb.es.js
CHANGED
|
@@ -3,23 +3,31 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description JavaScript Reverb effect class
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2019-
|
|
6
|
+
* @copyright 2019-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.4.
|
|
8
|
+
* @version 1.4.6
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { white as
|
|
13
|
-
import { take as
|
|
14
|
-
import { SYSTEM as
|
|
15
|
-
const
|
|
16
|
-
version: "1.4.
|
|
17
|
-
date: "
|
|
18
|
-
},
|
|
12
|
+
import { white as d, violet as b, red as p, pink as N, green as w, blue as y } from "@thi.ng/colored-noise";
|
|
13
|
+
import { take as g } from "@thi.ng/transducers";
|
|
14
|
+
import { SYSTEM as v } from "@thi.ng/random";
|
|
15
|
+
const u = {
|
|
16
|
+
version: "1.4.6",
|
|
17
|
+
date: "2026-03-06T12:11:28.691Z"
|
|
18
|
+
}, R = {
|
|
19
|
+
blue: y,
|
|
20
|
+
brown: p,
|
|
21
|
+
green: w,
|
|
22
|
+
pink: N,
|
|
23
|
+
red: p,
|
|
24
|
+
violet: b,
|
|
25
|
+
white: d
|
|
26
|
+
}, k = {
|
|
19
27
|
noise: "white",
|
|
20
28
|
scale: 1,
|
|
21
29
|
peaks: 2,
|
|
22
|
-
randomAlgorithm:
|
|
30
|
+
randomAlgorithm: v,
|
|
23
31
|
decay: 2,
|
|
24
32
|
delay: 0,
|
|
25
33
|
reverse: !1,
|
|
@@ -32,9 +40,9 @@ const c = {
|
|
|
32
40
|
};
|
|
33
41
|
class s {
|
|
34
42
|
/** Version strings */
|
|
35
|
-
static version =
|
|
43
|
+
static version = u.version;
|
|
36
44
|
/** Build date */
|
|
37
|
-
static build =
|
|
45
|
+
static build = u.date;
|
|
38
46
|
/** AudioContext */
|
|
39
47
|
ctx;
|
|
40
48
|
/** Wet Level (Reverberated node) */
|
|
@@ -52,20 +60,11 @@ class s {
|
|
|
52
60
|
/** Connected flag */
|
|
53
61
|
isConnected;
|
|
54
62
|
/** Noise Generator */
|
|
55
|
-
noise =
|
|
63
|
+
noise = d;
|
|
56
64
|
/**
|
|
57
65
|
* Map of noise types to their respective generator functions.
|
|
58
66
|
*/
|
|
59
|
-
noiseMap =
|
|
60
|
-
blue: g,
|
|
61
|
-
green: N,
|
|
62
|
-
pink: m,
|
|
63
|
-
red: d,
|
|
64
|
-
brown: d,
|
|
65
|
-
// brown is an alias for red
|
|
66
|
-
violet: f,
|
|
67
|
-
white: l
|
|
68
|
-
};
|
|
67
|
+
noiseMap = R;
|
|
69
68
|
/**
|
|
70
69
|
* Constructor
|
|
71
70
|
*
|
|
@@ -73,7 +72,7 @@ class s {
|
|
|
73
72
|
* @param options - Configure
|
|
74
73
|
*/
|
|
75
74
|
constructor(e, t) {
|
|
76
|
-
this.ctx = e, this.options = Object.assign(
|
|
75
|
+
this.ctx = e, this.options = Object.assign({}, k, 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);
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* Connect the node for the reverb effect to the original sound node.
|
|
@@ -200,7 +199,7 @@ class s {
|
|
|
200
199
|
*/
|
|
201
200
|
getNoise(e) {
|
|
202
201
|
return [
|
|
203
|
-
...
|
|
202
|
+
...g(
|
|
204
203
|
e,
|
|
205
204
|
this.noise({
|
|
206
205
|
bins: this.options.peaks,
|
|
@@ -216,7 +215,33 @@ class s {
|
|
|
216
215
|
* @param type - IR noise algorithm type.
|
|
217
216
|
*/
|
|
218
217
|
setNoise(e) {
|
|
219
|
-
this.options.noise = e,
|
|
218
|
+
switch (this.options.noise = e, e) {
|
|
219
|
+
case "blue":
|
|
220
|
+
this.noise = this.noiseMap.blue;
|
|
221
|
+
break;
|
|
222
|
+
case "brown":
|
|
223
|
+
this.noise = this.noiseMap.brown;
|
|
224
|
+
break;
|
|
225
|
+
case "green":
|
|
226
|
+
this.noise = this.noiseMap.green;
|
|
227
|
+
break;
|
|
228
|
+
case "pink":
|
|
229
|
+
this.noise = this.noiseMap.pink;
|
|
230
|
+
break;
|
|
231
|
+
case "red":
|
|
232
|
+
this.noise = this.noiseMap.red;
|
|
233
|
+
break;
|
|
234
|
+
case "violet":
|
|
235
|
+
this.noise = this.noiseMap.violet;
|
|
236
|
+
break;
|
|
237
|
+
case "white":
|
|
238
|
+
this.noise = this.noiseMap.white;
|
|
239
|
+
break;
|
|
240
|
+
default:
|
|
241
|
+
this.noise = d;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
this.buildImpulse();
|
|
220
245
|
}
|
|
221
246
|
/**
|
|
222
247
|
* Set Random Algorythm
|
|
@@ -238,12 +263,12 @@ class s {
|
|
|
238
263
|
}
|
|
239
264
|
/** Utility function for building an impulse response from the module parameters. */
|
|
240
265
|
buildImpulse() {
|
|
241
|
-
const e = this.ctx.sampleRate, t = Math.max(e * this.options.time, 1), o = e * this.options.delay,
|
|
266
|
+
const e = this.ctx.sampleRate, t = Math.max(e * this.options.time, 1), o = e * this.options.delay, h = this.ctx.createBuffer(2, t, e), l = new Float32Array(t), c = new Float32Array(t), n = new Float32Array(1), r = new Float32Array(1), f = this.getNoise(t), m = this.getNoise(t);
|
|
242
267
|
for (let i = 0; i < t; i++) {
|
|
243
|
-
let
|
|
244
|
-
i < o ? (
|
|
268
|
+
let a;
|
|
269
|
+
i < o ? (n[0] = 0, r[0] = 0, l.set(n, i), c.set(r, i), a = this.options.reverse ?? !1 ? t - (i - o) : i - o) : a = this.options.reverse ?? !1 ? t - i : i, n[0] = (f.at(i) ?? 0) * (1 - a / t) ** this.options.decay, r[0] = (m.at(i) ?? 0) * (1 - a / t) ** this.options.decay, l.set(n, i), c.set(r, i);
|
|
245
270
|
}
|
|
246
|
-
|
|
271
|
+
h.getChannelData(0).set(l), h.getChannelData(1).set(c), this.convolverNode.buffer = h;
|
|
247
272
|
}
|
|
248
273
|
}
|
|
249
274
|
export {
|
package/dist/Reverb.iife.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description JavaScript Reverb effect class
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2019-
|
|
6
|
+
* @copyright 2019-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.4.
|
|
8
|
+
* @version 1.4.6
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var Reverb=function(
|
|
12
|
+
var Reverb=(function(l,s,f,m){"use strict";const u={version:"1.4.6",date:"2026-03-06T12:11:28.691Z"},b={blue:s.blue,brown:s.red,green:s.green,pink:s.pink,red:s.red,violet:s.violet,white:s.white},w={noise:"white",scale:1,peaks:2,randomAlgorithm:m.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=s.white;noiseMap=b;constructor(e,t){this.ctx=e,this.options=Object.assign({},w,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),e.connect(this.wetGainNode),this.dryGainNode.connect(this.outputNode),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-e,this.wetGainNode.gain.value=e}time(e){if(!n.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of impulse 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] Impulse 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] Impulse 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()}getNoise(e){return[...f.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}setNoise(e){switch(this.options.noise=e,e){case"blue":this.noise=this.noiseMap.blue;break;case"brown":this.noise=this.noiseMap.brown;break;case"green":this.noise=this.noiseMap.green;break;case"pink":this.noise=this.noiseMap.pink;break;case"red":this.noise=this.noiseMap.red;break;case"violet":this.noise=this.noiseMap.violet;break;case"white":this.noise=this.noiseMap.white;break;default:this.noise=s.white;break}this.buildImpulse()}setRandomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,o){return e>=t&&e<=o}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),o=e*this.options.delay,c=this.ctx.createBuffer(2,t,e),d=new Float32Array(t),p=new Float32Array(t),a=new Float32Array(1),r=new Float32Array(1),v=this.getNoise(t),y=this.getNoise(t);for(let i=0;i<t;i++){let h;i<o?(a[0]=0,r[0]=0,d.set(a,i),p.set(r,i),h=this.options.reverse??!1?t-(i-o):i-o):h=this.options.reverse??!1?t-i:i,a[0]=(v.at(i)??0)*(1-h/t)**this.options.decay,r[0]=(y.at(i)??0)*(1-h/t)**this.options.decay,d.set(a,i),p.set(r,i)}c.getChannelData(0).set(d),c.getChannelData(1).set(p),this.convolverNode.buffer=c}}return l.default=n,Object.defineProperty(l,"__esModule",{value:!0}),l})({},coloredNoise,transducers,random);
|
package/dist/Reverb.umd.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description JavaScript Reverb effect class
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
|
-
* @copyright 2019-
|
|
6
|
+
* @copyright 2019-2026 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.4.
|
|
8
|
+
* @version 1.4.6
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
(function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@thi.ng/colored-noise"),require("@thi.ng/transducers"),require("@thi.ng/random")):typeof define=="function"&&define.amd?define(["exports","@thi.ng/colored-noise","@thi.ng/transducers","@thi.ng/random"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.Reverb={},n.coloredNoise,n.transducers,n.random))})(this,function(n,i,
|
|
12
|
+
(function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@thi.ng/colored-noise"),require("@thi.ng/transducers"),require("@thi.ng/random")):typeof define=="function"&&define.amd?define(["exports","@thi.ng/colored-noise","@thi.ng/transducers","@thi.ng/random"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.Reverb={},n.coloredNoise,n.transducers,n.random))})(this,(function(n,i,f,m){"use strict";const u={version:"1.4.6",date:"2026-03-06T12:11:28.691Z"},b={blue:i.blue,brown:i.red,green:i.green,pink:i.pink,red:i.red,violet:i.violet,white:i.white},w={noise:"white",scale:1,peaks:2,randomAlgorithm:m.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class o{static version=u.version;static build=u.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=i.white;noiseMap=b;constructor(e,t){this.ctx=e,this.options=Object.assign({},w,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),e.connect(this.wetGainNode),this.dryGainNode.connect(this.outputNode),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(!o.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-e,this.wetGainNode.gain.value=e}time(e){if(!o.inRange(e,1,50))throw new RangeError("[Reverb.js] Time length of impulse response must be less than 50sec.");this.options.time=e,this.buildImpulse()}decay(e){if(!o.inRange(e,0,100))throw new RangeError("[Reverb.js] Impulse Response decay level must be less than 100.");this.options.decay=e,this.buildImpulse()}delay(e){if(!o.inRange(e,0,100))throw new RangeError("[Reverb.js] Impulse 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(!o.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(!o.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()}getNoise(e){return[...f.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}setNoise(e){switch(this.options.noise=e,e){case"blue":this.noise=this.noiseMap.blue;break;case"brown":this.noise=this.noiseMap.brown;break;case"green":this.noise=this.noiseMap.green;break;case"pink":this.noise=this.noiseMap.pink;break;case"red":this.noise=this.noiseMap.red;break;case"violet":this.noise=this.noiseMap.violet;break;case"white":this.noise=this.noiseMap.white;break;default:this.noise=i.white;break}this.buildImpulse()}setRandomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,r){return e>=t&&e<=r}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),r=e*this.options.delay,d=this.ctx.createBuffer(2,t,e),c=new Float32Array(t),p=new Float32Array(t),a=new Float32Array(1),h=new Float32Array(1),g=this.getNoise(t),y=this.getNoise(t);for(let s=0;s<t;s++){let l;s<r?(a[0]=0,h[0]=0,c.set(a,s),p.set(h,s),l=this.options.reverse??!1?t-(s-r):s-r):l=this.options.reverse??!1?t-s:s,a[0]=(g.at(s)??0)*(1-l/t)**this.options.decay,h[0]=(y.at(s)??0)*(1-l/t)**this.options.decay,c.set(a,s),p.set(h,s)}d.getChannelData(0).set(c),d.getChannelData(1).set(p),this.convolverNode.buffer=d}}n.default=o,Object.defineProperty(n,"__esModule",{value:!0})}));
|
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.4.
|
|
4
|
+
"version": "1.4.6",
|
|
5
5
|
"description": "JavaScript Reverb effect class",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"webaudio",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"node": "^20.19.0 || >=22.12.0",
|
|
51
51
|
"pnpm": ">=10.2.0"
|
|
52
52
|
},
|
|
53
|
-
"packageManager": "pnpm@10.
|
|
53
|
+
"packageManager": "pnpm@10.30.3",
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"scripts": {
|
|
56
56
|
"dev": "vite",
|
|
@@ -61,12 +61,16 @@
|
|
|
61
61
|
"build:analyze": "vite build --mode=analyze",
|
|
62
62
|
"build:clean": "rimraf dist",
|
|
63
63
|
"build-only": "vite build",
|
|
64
|
-
"lint": "
|
|
64
|
+
"lint": "run-s lint:*",
|
|
65
|
+
"lint:oxlint": "oxlint . --fix",
|
|
66
|
+
"lint:eslint": "eslint . --fix --cache --cache-location ./node_modules/.vite/eslint-cache",
|
|
67
|
+
"lint:prettier": "prettier \"./**/*.{js,ts,json,css,sass,scss,htm,html,vue,md}\" -w -u",
|
|
65
68
|
"preview": "vite preview --mode=docs",
|
|
66
69
|
"prepare": "husky",
|
|
67
70
|
"test": "vitest",
|
|
68
71
|
"test:run": "vitest run",
|
|
69
|
-
"test:coverage": "vitest run --coverage"
|
|
72
|
+
"test:coverage": "vitest run --coverage",
|
|
73
|
+
"version": "auto-changelog -p && git add CHANGELOG.md"
|
|
70
74
|
},
|
|
71
75
|
"peerDependencies": {
|
|
72
76
|
"@thi.ng/colored-noise": "^1.0.103",
|
|
@@ -74,34 +78,36 @@
|
|
|
74
78
|
"@thi.ng/transducers": "^9.5.1"
|
|
75
79
|
},
|
|
76
80
|
"devDependencies": {
|
|
77
|
-
"@eslint/js": "^
|
|
78
|
-
"@tsconfig/node-lts": "^
|
|
79
|
-
"@types/node": "^
|
|
80
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
81
|
-
"@vitest/coverage-v8": "^
|
|
81
|
+
"@eslint/js": "^10.0.1",
|
|
82
|
+
"@tsconfig/node-lts": "^24.0.0",
|
|
83
|
+
"@types/node": "^25.3.5",
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
85
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
82
86
|
"bootstrap": "^5.3.8",
|
|
83
|
-
"eslint": "^
|
|
87
|
+
"eslint": "^10.0.2",
|
|
84
88
|
"eslint-config-prettier": "^10.1.8",
|
|
85
89
|
"eslint-import-resolver-custom-alias": "^1.3.2",
|
|
86
90
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
87
|
-
"eslint-plugin-import": "^
|
|
88
|
-
"eslint-plugin-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
92
|
+
"eslint-plugin-oxlint": "^1.51.0",
|
|
93
|
+
"eslint-plugin-security": "^4.0.0",
|
|
94
|
+
"globals": "^17.4.0",
|
|
95
|
+
"happy-dom": "^20.8.3",
|
|
91
96
|
"husky": "^9.1.7",
|
|
92
97
|
"jiti": "^2.6.1",
|
|
93
|
-
"lint-staged": "^16.2
|
|
98
|
+
"lint-staged": "^16.3.2",
|
|
94
99
|
"npm-run-all2": "^8.0.4",
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
100
|
+
"oxlint": "^1.51.0",
|
|
101
|
+
"prettier": "^3.8.1",
|
|
102
|
+
"rimraf": "^6.1.3",
|
|
103
|
+
"rollup-plugin-visualizer": "^7.0.1",
|
|
98
104
|
"typescript": "^5.9.3",
|
|
99
|
-
"typescript-eslint": "^8.
|
|
100
|
-
"vite": "^7.1
|
|
105
|
+
"typescript-eslint": "^8.56.1",
|
|
106
|
+
"vite": "^7.3.1",
|
|
101
107
|
"vite-plugin-banner": "^0.8.1",
|
|
102
|
-
"vite-plugin-checker": "^0.
|
|
108
|
+
"vite-plugin-checker": "^0.12.0",
|
|
103
109
|
"vite-plugin-dts": "^4.5.4",
|
|
104
|
-
"vitest": "^
|
|
110
|
+
"vitest": "^4.0.18"
|
|
105
111
|
},
|
|
106
112
|
"husky": {
|
|
107
113
|
"hooks": {
|
|
@@ -114,6 +120,7 @@
|
|
|
114
120
|
},
|
|
115
121
|
"resolutions": {
|
|
116
122
|
"json5": ">=2.2.3",
|
|
117
|
-
"
|
|
123
|
+
"minimatch": ">=10.2.3",
|
|
124
|
+
"yaml": ">=2.6.0"
|
|
118
125
|
}
|
|
119
|
-
}
|
|
126
|
+
}
|