@logue/reverb 1.3.10 → 1.3.11
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 +3 -3
- package/dist/Reverb.iife.js +2 -2
- package/dist/Reverb.umd.js +2 -2
- package/package.json +24 -24
package/dist/Reverb.es.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.11
|
|
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.
|
|
17
|
-
date: "2024-
|
|
16
|
+
version: "1.3.11",
|
|
17
|
+
date: "2024-09-28T15:49:37.962Z"
|
|
18
18
|
}, o = {
|
|
19
19
|
/** Blue noise */
|
|
20
20
|
blue: "blue",
|
package/dist/Reverb.iife.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.11
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
var Reverb=function(n,p,u){"use strict";const d={version:"1.3.
|
|
12
|
+
var Reverb=function(n,p,u){"use strict";const d={version:"1.3.11",date:"2024-09-28T15:49:37.962Z"},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);
|
package/dist/Reverb.umd.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2019-2024 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.3.
|
|
8
|
+
* @version 1.3.11
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
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.
|
|
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.11",date:"2024-09-28T15:49:37.962Z"},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.
|
|
4
|
+
"version": "1.3.11",
|
|
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": ">=
|
|
44
|
-
"pnpm": ">=9.
|
|
43
|
+
"node": ">=22.7.4",
|
|
44
|
+
"pnpm": ">=9.11.0"
|
|
45
45
|
},
|
|
46
|
-
"packageManager": "pnpm@9.
|
|
46
|
+
"packageManager": "pnpm@9.11.0",
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"scripts": {
|
|
49
49
|
"dev": "vite",
|
|
@@ -56,41 +56,41 @@
|
|
|
56
56
|
"build-only": "vite build",
|
|
57
57
|
"lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
|
|
58
58
|
"preview": "vite preview --mode=docs",
|
|
59
|
-
"prepare": "husky
|
|
59
|
+
"prepare": "husky"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@thi.ng/colored-noise": "^1.0.
|
|
63
|
-
"@thi.ng/transducers": "^9.
|
|
62
|
+
"@thi.ng/colored-noise": "^1.0.80",
|
|
63
|
+
"@thi.ng/transducers": "^9.2.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@eslint/js": "^9.
|
|
66
|
+
"@eslint/js": "^9.11.1",
|
|
67
67
|
"@tsconfig/node-lts": "^20.1.3",
|
|
68
|
-
"@types/node": "^22.
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^8.0
|
|
68
|
+
"@types/node": "^22.7.4",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
70
70
|
"bootstrap": "^5.3.3",
|
|
71
|
-
"eslint": "^9.
|
|
71
|
+
"eslint": "^9.11.1",
|
|
72
72
|
"eslint-config-prettier": "^9.1.0",
|
|
73
|
-
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
74
73
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
75
|
-
"eslint-import-resolver-typescript": "^3.6.
|
|
76
|
-
"eslint-plugin-html": "^8.1.
|
|
77
|
-
"eslint-plugin-import": "^2.
|
|
78
|
-
"eslint-plugin-n": "^17.10.
|
|
74
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
75
|
+
"eslint-plugin-html": "^8.1.2",
|
|
76
|
+
"eslint-plugin-import": "^2.30.0",
|
|
77
|
+
"eslint-plugin-n": "^17.10.3",
|
|
79
78
|
"eslint-plugin-promise": "^7.1.0",
|
|
80
79
|
"eslint-plugin-tsdoc": "^0.3.0",
|
|
81
80
|
"eslint-plugin-yaml": "^1.0.3",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
81
|
+
"globals": "^15.9.0",
|
|
82
|
+
"husky": "^9.1.6",
|
|
83
|
+
"lint-staged": "^15.2.10",
|
|
84
84
|
"npm-run-all": "^4.1.5",
|
|
85
85
|
"prettier": "^3.3.3",
|
|
86
86
|
"rimraf": "^6.0.1",
|
|
87
87
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
88
|
-
"typescript": "^5.
|
|
89
|
-
"typescript-eslint": "^8.0
|
|
90
|
-
"vite": "^5.4.
|
|
91
|
-
"vite-plugin-banner": "^0.
|
|
92
|
-
"vite-plugin-checker": "^0.
|
|
93
|
-
"vite-plugin-dts": "^4.
|
|
88
|
+
"typescript": "^5.6.2",
|
|
89
|
+
"typescript-eslint": "^8.7.0",
|
|
90
|
+
"vite": "^5.4.8",
|
|
91
|
+
"vite-plugin-banner": "^0.8.0",
|
|
92
|
+
"vite-plugin-checker": "^0.8.0",
|
|
93
|
+
"vite-plugin-dts": "^4.2.2"
|
|
94
94
|
},
|
|
95
95
|
"husky": {
|
|
96
96
|
"hooks": {
|