@logue/reverb 1.3.12 → 1.3.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2023 Masashi Yoshikawa <https://logue.dev>
3
+ Copyright (c) 2019-2025 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
@@ -103,4 +103,4 @@ The dependent libraries [@thi.ng/colored-noise](https://www.jsdelivr.com/package
103
103
 
104
104
  ## License
105
105
 
106
- ©2019-2024 by Logue. Licensed under the [MIT License](LICENSE).
106
+ ©2019-2025 by Logue. Licensed under the [MIT License](LICENSE).
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAC;AAG1D,QAAA,MAAM,IAAI,EAAE,aAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoiseType.d.ts","sourceRoot":"","sources":["../src/NoiseType.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAe3B,CAAC;AAEX,iBAAiB;AACjB,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,CAAC;AAEZ,YAAY;AACZ,eAAe,KAAK,CAAC"}
@@ -6,9 +6,9 @@ import { NoiseType } from './NoiseType';
6
6
  */
7
7
  export default class Reverb {
8
8
  /** Version strings */
9
- static version: string;
9
+ static readonly version: string;
10
10
  /** Build date */
11
- static build: string;
11
+ static readonly build: string;
12
12
  /** AudioContext */
13
13
  private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,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAU7B;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahC;;;;OAIG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWjC;;;;OAIG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAajC;;;;OAIG;IACI,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQtC;;;;OAIG;IACI,UAAU,CAAC,IAAI,GAAE,gBAA4B,GAAG,IAAI;IAK3D;;;;OAIG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAWrC;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAW/B;;;;OAIG;IACI,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAM7B;;;;OAIG;IACI,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAM7B;;;;OAIG;IACI,eAAe,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAMtC;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IA0BtC;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI;IAKjD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB,oFAAoF;IACpF,OAAO,CAAC,YAAY;IA+CpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAYjB"}
package/dist/Reverb.es.js CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * @description JavaScript Reverb effect class
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2025 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.12
8
+ * @version 1.3.13
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
@@ -13,8 +13,8 @@ import { white as c, violet as m, red as f, pink as b, green as N, blue as g } f
13
13
  import { take as v } from "@thi.ng/transducers";
14
14
  import { SYSTEM as w } from "@thi.ng/random";
15
15
  const d = {
16
- version: "1.3.12",
17
- date: "2024-11-23T00:05:59.815Z"
16
+ version: "1.3.13",
17
+ date: "2025-01-06T13:47:25.170Z"
18
18
  }, o = {
19
19
  /** Blue noise */
20
20
  blue: "blue",
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * @description JavaScript Reverb effect class
5
5
  * @author Logue <logue@hotmail.co.jp>
6
- * @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2025 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.12
8
+ * @version 1.3.13
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
12
- var Reverb=function(h,n,p,f){"use strict";const u={version:"1.3.12",date:"2024-11-23T00:05:59.815Z"},o={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},m={noise:"white",scale:1,peaks:2,randomAlgorithm:f.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class s{static version=u.version;static build=u.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=n.white;constructor(e,t){this.ctx=e,this.options=Object.assign(m,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,l=this.ctx.createBuffer(2,t,e),c=new Float32Array(t),d=new Float32Array(t),b=this.getNoise(t),v=this.getNoise(t);for(let i=0;i<t;i++){let a=0;i<r?(c[i]=0,d[i]=0,a=this.options.reverse??!1?t-(i-r):i-r):a=this.options.reverse??!1?t-i:i,c[i]=(b[i]??0)*(1-a/t)**this.options.decay,d[i]=(v[i]??0)*(1-a/t)**this.options.decay}l.getChannelData(0).set(c),l.getChannelData(1).set(d),this.convolverNode.buffer=l}getNoise(e){return[...p.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return h.default=s,Object.defineProperty(h,"__esModule",{value:!0}),h}({},coloredNoise,transducers,random);
12
+ var Reverb=function(h,n,p,f){"use strict";const u={version:"1.3.13",date:"2025-01-06T13:47:25.170Z"},o={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},m={noise:"white",scale:1,peaks:2,randomAlgorithm:f.SYSTEM,decay:2,delay:0,reverse:!1,time:2,filterType:"allpass",filterFreq:2200,filterQ:1,mix:.5,once:!1};class s{static version=u.version;static build=u.date;ctx;wetGainNode;dryGainNode;filterNode;convolverNode;outputNode;options;isConnected;noise=n.white;constructor(e,t){this.ctx=e,this.options=Object.assign(m,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,l=this.ctx.createBuffer(2,t,e),c=new Float32Array(t),d=new Float32Array(t),b=this.getNoise(t),v=this.getNoise(t);for(let i=0;i<t;i++){let a=0;i<r?(c[i]=0,d[i]=0,a=this.options.reverse??!1?t-(i-r):i-r):a=this.options.reverse??!1?t-i:i,c[i]=(b[i]??0)*(1-a/t)**this.options.decay,d[i]=(v[i]??0)*(1-a/t)**this.options.decay}l.getChannelData(0).set(c),l.getChannelData(1).set(d),this.convolverNode.buffer=l}getNoise(e){return[...p.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}return h.default=s,Object.defineProperty(h,"__esModule",{value:!0}),h}({},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-2024 By Masashi Yoshikawa All rights reserved.
6
+ * @copyright 2019-2025 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.3.12
8
+ * @version 1.3.13
9
9
  * @see {@link https://github.com/logue/Reverb.js}
10
10
  */
11
11
 
12
- (function(n,s){typeof exports=="object"&&typeof module<"u"?s(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"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.Reverb={},n.coloredNoise,n.transducers,n.random))})(this,function(n,s,p,f){"use strict";const u={version:"1.3.12",date:"2024-11-23T00:05:59.815Z"},r={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},m={noise:"white",scale:1,peaks:2,randomAlgorithm:f.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=s.white;constructor(e,t){this.ctx=e,this.options=Object.assign(m,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(!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-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!o.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(!o.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(!o.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(!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()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case r.blue:this.noise=s.blue;break;case r.green:this.noise=s.green;break;case r.pink:this.noise=s.pink;break;case r.red:case r.brown:this.noise=s.red;break;case r.violet:this.noise=s.violet;break;default:this.noise=s.white}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,h){return(e-t)*(e-h)<=0}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),h=e*this.options.delay,l=this.ctx.createBuffer(2,t,e),d=new Float32Array(t),c=new Float32Array(t),b=this.getNoise(t),g=this.getNoise(t);for(let i=0;i<t;i++){let a=0;i<h?(d[i]=0,c[i]=0,a=this.options.reverse??!1?t-(i-h):i-h):a=this.options.reverse??!1?t-i:i,d[i]=(b[i]??0)*(1-a/t)**this.options.decay,c[i]=(g[i]??0)*(1-a/t)**this.options.decay}l.getChannelData(0).set(d),l.getChannelData(1).set(c),this.convolverNode.buffer=l}getNoise(e){return[...p.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}n.default=o,Object.defineProperty(n,"__esModule",{value:!0})});
12
+ (function(n,s){typeof exports=="object"&&typeof module<"u"?s(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"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.Reverb={},n.coloredNoise,n.transducers,n.random))})(this,function(n,s,p,f){"use strict";const u={version:"1.3.13",date:"2025-01-06T13:47:25.170Z"},r={blue:"blue",brown:"red",green:"green",pink:"pink",red:"red",violet:"violet",white:"white"},m={noise:"white",scale:1,peaks:2,randomAlgorithm:f.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=s.white;constructor(e,t){this.ctx=e,this.options=Object.assign(m,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(!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-this.options.mix,this.wetGainNode.gain.value=this.options.mix}time(e){if(!o.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(!o.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(!o.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(!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()}randomAlgorithm(e){this.options.randomAlgorithm=e,this.buildImpulse()}setNoise(e){switch(this.options.noise=e,e){case r.blue:this.noise=s.blue;break;case r.green:this.noise=s.green;break;case r.pink:this.noise=s.pink;break;case r.red:case r.brown:this.noise=s.red;break;case r.violet:this.noise=s.violet;break;default:this.noise=s.white}this.buildImpulse()}setRandomAlgorythm(e){this.options.randomAlgorithm=e,this.buildImpulse()}static inRange(e,t,h){return(e-t)*(e-h)<=0}buildImpulse(){const e=this.ctx.sampleRate,t=Math.max(e*this.options.time,1),h=e*this.options.delay,l=this.ctx.createBuffer(2,t,e),d=new Float32Array(t),c=new Float32Array(t),b=this.getNoise(t),g=this.getNoise(t);for(let i=0;i<t;i++){let a=0;i<h?(d[i]=0,c[i]=0,a=this.options.reverse??!1?t-(i-h):i-h):a=this.options.reverse??!1?t-i:i,d[i]=(b[i]??0)*(1-a/t)**this.options.decay,c[i]=(g[i]??0)*(1-a/t)**this.options.decay}l.getChannelData(0).set(d),l.getChannelData(1).set(c),this.convolverNode.buffer=l}getNoise(e){return[...p.take(e,this.noise({bins:this.options.peaks,scale:this.options.scale,rnd:this.options.randomAlgorithm}))]}}n.default=o,Object.defineProperty(n,"__esModule",{value:!0})});
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetaInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/MetaInterface.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,CAAC,OAAO,WAAW,aAAa;IACpC,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionInterface.d.ts","sourceRoot":"","sources":["../../src/interfaces/OptionInterface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oBAAoB;AACpB,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC;IACvB,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,oBAAoB;AACpB,eAAO,MAAM,QAAQ,EAAE,eActB,CAAC"}
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.12",
4
+ "version": "1.3.13",
5
5
  "description": "JavaScript Reverb effect class",
6
6
  "keywords": [
7
7
  "webaudio",
@@ -34,16 +34,14 @@
34
34
  "exports": {
35
35
  ".": {
36
36
  "import": "./dist/Reverb.es.js",
37
- "require": "./dist/Reverb.umd.js",
38
- "browser": "./dist/Reverb.iife.js",
39
- "types": "./dist/src/Reverb.d.ts"
37
+ "require": "./dist/Reverb.umd.js"
40
38
  }
41
39
  },
42
40
  "engines": {
43
41
  "node": ">=22.0.0",
44
- "pnpm": ">=9.14.2"
42
+ "pnpm": ">=9.15.0"
45
43
  },
46
- "packageManager": "pnpm@9.14.2",
44
+ "packageManager": "pnpm@9.15.3",
47
45
  "sideEffects": false,
48
46
  "scripts": {
49
47
  "dev": "vite",
@@ -59,39 +57,39 @@
59
57
  "prepare": "husky"
60
58
  },
61
59
  "dependencies": {
62
- "@thi.ng/colored-noise": "^1.0.84",
63
- "@thi.ng/random": "^4.1.3",
64
- "@thi.ng/transducers": "^9.2.8"
60
+ "@thi.ng/colored-noise": "^1.0.89",
61
+ "@thi.ng/random": "^4.1.7",
62
+ "@thi.ng/transducers": "^9.2.12"
65
63
  },
66
64
  "devDependencies": {
67
- "@eslint/js": "^9.15.0",
68
- "@tsconfig/node-lts": "^22.0.0",
69
- "@types/node": "^22.9.1",
70
- "@typescript-eslint/eslint-plugin": "^8.15.0",
65
+ "@eslint/js": "^9.17.0",
66
+ "@tsconfig/node-lts": "^22.0.1",
67
+ "@types/node": "^22.10.5",
68
+ "@typescript-eslint/eslint-plugin": "^8.19.0",
71
69
  "bootstrap": "^5.3.3",
72
- "eslint": "^9.15.0",
70
+ "eslint": "^9.17.0",
73
71
  "eslint-config-prettier": "^9.1.0",
74
72
  "eslint-import-resolver-alias": "^1.1.2",
75
- "eslint-import-resolver-typescript": "^3.6.3",
73
+ "eslint-import-resolver-typescript": "^3.7.0",
76
74
  "eslint-plugin-html": "^8.1.2",
77
75
  "eslint-plugin-import": "^2.31.0",
78
- "eslint-plugin-n": "^17.14.0",
79
- "eslint-plugin-promise": "^7.1.0",
80
- "eslint-plugin-tsdoc": "^0.3.0",
76
+ "eslint-plugin-n": "^17.15.1",
77
+ "eslint-plugin-promise": "^7.2.1",
78
+ "eslint-plugin-tsdoc": "^0.4.0",
81
79
  "eslint-plugin-yaml": "^1.0.3",
82
- "globals": "^15.12.0",
80
+ "globals": "^15.14.0",
83
81
  "husky": "^9.1.7",
84
- "lint-staged": "^15.2.10",
82
+ "lint-staged": "^15.3.0",
85
83
  "npm-run-all": "^4.1.5",
86
- "prettier": "^3.3.3",
84
+ "prettier": "^3.4.2",
87
85
  "rimraf": "^6.0.1",
88
- "rollup-plugin-visualizer": "^5.12.0",
89
- "typescript": "^5.6.3",
90
- "typescript-eslint": "^8.15.0",
91
- "vite": "^5.4.11",
86
+ "rollup-plugin-visualizer": "^5.13.1",
87
+ "typescript": "^5.7.2",
88
+ "typescript-eslint": "^8.19.0",
89
+ "vite": "^6.0.7",
92
90
  "vite-plugin-banner": "^0.8.0",
93
91
  "vite-plugin-checker": "^0.8.0",
94
- "vite-plugin-dts": "^4.3.0"
92
+ "vite-plugin-dts": "^4.4.0"
95
93
  },
96
94
  "husky": {
97
95
  "hooks": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"Meta.d.ts","sourceRoot":"","sources":["../../src/Meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAC;AAG1D,QAAA,MAAM,IAAI,EAAE,aAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoiseType.d.ts","sourceRoot":"","sources":["../../src/NoiseType.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAe3B,CAAC;AAEX,iBAAiB;AACjB,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,CAAC;AAEZ,YAAY;AACZ,eAAe,KAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Reverb.d.ts","sourceRoot":"","sources":["../../src/Reverb.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,eAAe,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAGpD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,sBAAsB;IACtB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAgB;IACtC,iBAAiB;IACjB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAa;IACjC,mBAAmB;IACnB,OAAO,CAAC,QAAQ,CAA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CAAC,EAAE,MAAM,GAAG,IAAI;IAM7B;;;;OAIG;IACI,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAM7B;;;;OAIG;IACI,eAAe,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAMtC;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IA0BtC;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI;IAKjD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB,oFAAoF;IACpF,OAAO,CAAC,YAAY;IA+CpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAYjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetaInterface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/MetaInterface.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,CAAC,OAAO,WAAW,aAAa;IACpC,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"OptionInterface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/OptionInterface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oBAAoB;AACpB,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC;IACvB,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,oBAAoB;AACpB,eAAO,MAAM,QAAQ,EAAE,eActB,CAAC"}
File without changes
File without changes