@jpdutoit/squelchy 0.0.4 → 0.0.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/README.md +5 -1
- package/{chunk-N7J25N5J.js → chunk-PJDNZ52Q.js} +21 -5
- package/chunk-PJDNZ52Q.js.map +7 -0
- package/docs/GUIDE.md +87 -9
- package/docs/MODULES.md +47 -37
- package/docs/modules.json +114 -32
- package/index.d.ts +99 -30
- package/index.js +557 -362
- package/index.js.map +3 -3
- package/kits/compu-78/bd.flac +0 -0
- package/kits/compu-78/ch.flac +0 -0
- package/kits/compu-78/clap.flac +0 -0
- package/kits/compu-78/cym.flac +0 -0
- package/kits/compu-78/ht.flac +0 -0
- package/kits/compu-78/lt.flac +0 -0
- package/kits/compu-78/mt.flac +0 -0
- package/kits/compu-78/oh.flac +0 -0
- package/kits/compu-78/perc.flac +0 -0
- package/kits/compu-78/rim.flac +0 -0
- package/kits/compu-78/sd.flac +0 -0
- package/kits/deep-analogue/bd.flac +0 -0
- package/kits/deep-analogue/ch.flac +0 -0
- package/kits/deep-analogue/clap.flac +0 -0
- package/kits/deep-analogue/cym.flac +0 -0
- package/kits/deep-analogue/ht.flac +0 -0
- package/kits/deep-analogue/lt.flac +0 -0
- package/kits/deep-analogue/mt.flac +0 -0
- package/kits/deep-analogue/oh.flac +0 -0
- package/kits/deep-analogue/perc.flac +0 -0
- package/kits/deep-analogue/rim.flac +0 -0
- package/kits/deep-analogue/sd.flac +0 -0
- package/kits/hard-cell/bd.flac +0 -0
- package/kits/hard-cell/ch.flac +0 -0
- package/kits/hard-cell/clap.flac +0 -0
- package/kits/hard-cell/cym.flac +0 -0
- package/kits/hard-cell/ht.flac +0 -0
- package/kits/hard-cell/lt.flac +0 -0
- package/kits/hard-cell/mt.flac +0 -0
- package/kits/hard-cell/oh.flac +0 -0
- package/kits/hard-cell/perc.flac +0 -0
- package/kits/hard-cell/rim.flac +0 -0
- package/kits/hard-cell/sd.flac +0 -0
- package/kits/micro-click/bd.flac +0 -0
- package/kits/micro-click/ch.flac +0 -0
- package/kits/micro-click/clap.flac +0 -0
- package/kits/micro-click/cym.flac +0 -0
- package/kits/micro-click/ht.flac +0 -0
- package/kits/micro-click/lt.flac +0 -0
- package/kits/micro-click/mt.flac +0 -0
- package/kits/micro-click/oh.flac +0 -0
- package/kits/micro-click/perc.flac +0 -0
- package/kits/micro-click/rim.flac +0 -0
- package/kits/micro-click/sd.flac +0 -0
- package/kits/tape-dust/bd.flac +0 -0
- package/kits/tape-dust/ch.flac +0 -0
- package/kits/tape-dust/clap.flac +0 -0
- package/kits/tape-dust/cym.flac +0 -0
- package/kits/tape-dust/ht.flac +0 -0
- package/kits/tape-dust/lt.flac +0 -0
- package/kits/tape-dust/mt.flac +0 -0
- package/kits/tape-dust/oh.flac +0 -0
- package/kits/tape-dust/perc.flac +0 -0
- package/kits/tape-dust/rim.flac +0 -0
- package/kits/tape-dust/sd.flac +0 -0
- package/package.json +1 -1
- package/{worklets-inline-EF3OTQ4D.js → worklets-inline-NWG5PWND.js} +10 -2
- package/{worklets-inline-EF3OTQ4D.js.map → worklets-inline-NWG5PWND.js.map} +2 -2
- package/chunk-N7J25N5J.js.map +0 -7
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ import { preload, Vco, Lfo, Delay, semitones, sec, hz } from '@jpdutoit/squelchy
|
|
|
18
18
|
const ctx = new AudioContext();
|
|
19
19
|
await preload(ctx); // registers the worklets of the modules you import
|
|
20
20
|
|
|
21
|
-
const vco = Vco.create(ctx, { offset: semitones(57) }); //
|
|
21
|
+
const vco = Vco.create(ctx, { offset: semitones(57) }); // nothing in voct = note 0 (C-1); 57 semitones up = A3
|
|
22
22
|
const lfo = Lfo.create(ctx, { frequency: hz(5), amount: semitones(0.3) });
|
|
23
23
|
const delay = Delay.create(ctx, { time: sec(0.3), feedback: 0.4, mix: 0.35 });
|
|
24
24
|
|
|
@@ -32,6 +32,8 @@ delay.params.mix.linearRampToValueAtTime(0.8, ctx.currentTime + 2);
|
|
|
32
32
|
|
|
33
33
|
Browsers only start audio after a user gesture, so create or `resume()` the `AudioContext` inside a click handler.
|
|
34
34
|
|
|
35
|
+
Importing the package is safe on the server (SSR, Node tests): nothing touches Web Audio until you call `preload()` or `create()`, so a static `import` in shared code is fine.
|
|
36
|
+
|
|
35
37
|
## Patterns and time
|
|
36
38
|
|
|
37
39
|
Musical positions are plain numbers in beats, and patterns are plain arrays.
|
|
@@ -66,6 +68,8 @@ bd.connect(ctx.destination);
|
|
|
66
68
|
bd.trigger(now(ctx)); // times are typed Seconds; now(ctx) is ctx.currentTime
|
|
67
69
|
```
|
|
68
70
|
|
|
71
|
+
**Vite 6 or 7:** add `optimizeDeps: { exclude: ['@jpdutoit/squelchy'] }` to `vite.config`, or kit sounds fail to load in the dev server (production builds work either way). Vite 8 needs nothing. Details in `docs/GUIDE.md`.
|
|
72
|
+
|
|
69
73
|
## Reference
|
|
70
74
|
|
|
71
75
|
- `docs/GUIDE.md`: recipes for scheduling (transport options, automation at musical positions, synced visuals), sequencing synth voices, `pulse()` actions, units, sample kits and offline rendering.
|
|
@@ -2,22 +2,25 @@
|
|
|
2
2
|
var adsr_envelope_default = '(()=>{var x=Object.defineProperty;var R=(a,t,r)=>t in a?x(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r;var e=(a,t,r)=>R(a,typeof t!="symbol"?t+"":t,r);const L=Math.log(1e3);class D extends AudioWorkletProcessor{constructor(){super(...arguments);e(this,"_stage",0);e(this,"_level",0);e(this,"_prevGate",0);e(this,"_hold",0);e(this,"_prevEff",!1);e(this,"_dFor",-1);e(this,"_kd",0);e(this,"_rFor",-1);e(this,"_kr",0)}static get parameterDescriptors(){return[{name:"attack",defaultValue:.01,minValue:.001,maxValue:2},{name:"decay",defaultValue:.46,minValue:.001,maxValue:10},{name:"sustain",defaultValue:.7,minValue:0,maxValue:1},{name:"release",defaultValue:2.1,minValue:.001,maxValue:20}]}process(r,V,i){const f=r[0]?.[0],n=V[0]?.[0];if(!n)return!0;const l=sampleRate,c=i.attack,_=i.decay,v=i.sustain,u=i.release;for(let s=0;s<n.length;s++){const p=f?f[s]:0,g=p>.5,F=this._prevGate>.5,k=c.length>1?c[s]:c[0],o=_.length>1?_[s]:_[0],d=v.length>1?v[s]:v[0],E=u.length>1?u[s]:u[0];g&&!F?(this._hold=Math.ceil((k+o)*l)+1,this._stage=1):this._hold>0&&this._hold--;const A=g||this._hold>0,m=this._prevEff;switch(A&&!m?this._stage=1:!A&&m&&(this._stage=4),this._stage){case 1:{const h=1/Math.max(k*l,1);this._level+=h,this._level>=1&&(this._level=1,this._stage=2);break}case 2:{o!==this._dFor&&(this._dFor=o,this._kd=Math.exp(-L/Math.max(o*l,1)));const h=(this._level-d)*this._kd;this._level=Math.abs(h)<1e-7?d:d+h;break}case 4:{E!==this._rFor&&(this._rFor=E,this._kr=Math.exp(-L/Math.max(E*l,1))),this._level*=this._kr,this._level<=1e-5&&(this._level=0,this._stage=0);break}case 0:default:this._level=0;break}this._prevGate=p,this._prevEff=A,n[s]=this._level}return!0}}registerProcessor("adsr-envelope",D);})();\n';
|
|
3
3
|
|
|
4
4
|
// src/lib-runtime/generated/worklet-src/bitcrusher.ts
|
|
5
|
-
var bitcrusher_default = '(()=>{var
|
|
5
|
+
var bitcrusher_default = '(()=>{var V=Object.defineProperty;var _=(e,t,r)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t,r)=>_(e,typeof t!="symbol"?t+"":t,r);const d=(e,t)=>{const r=2/Math.pow(2,t);return Math.round(e/r)*r},y=(e,t)=>{if(t>=2)return d(e,t);const r=e>0?1:e<0?-1:0,a=Math.max(0,t-1);return a===0?r:r*(1-a)+d(e,2)*a};class F extends AudioWorkletProcessor{constructor(){super(...arguments);l(this,"_held",[0,0]);l(this,"_phase",0)}static get parameterDescriptors(){return[{name:"bits",defaultValue:8,minValue:1,maxValue:16},{name:"rate",defaultValue:1,minValue:.01,maxValue:1}]}process(r,a,h){const i=r[0],o=a[0];if(!o||o.length===0)return!0;const m=o.length,g=o[0].length,c=h.bits,u=h.rate,p=this._held;for(let n=0;n<g;n++){const f=c.length>1?c[n]:c[0],b=u.length>1?u[n]:u[0];if(this._phase+=b,this._phase>=1){this._phase-=1;for(let s=0;s<m;s++){const A=i?.[s]?.[n]??i?.[0]?.[n]??0;p[s]=y(A,f)}}for(let s=0;s<m;s++)o[s][n]=p[s]}return!0}}registerProcessor("bitcrusher",F);})();\n';
|
|
6
6
|
|
|
7
7
|
// src/lib-runtime/generated/worklet-src/comb-filter.ts
|
|
8
8
|
var comb_filter_default = '(()=>{var V=Object.defineProperty;var X=(a,e,r)=>e in a?V(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>X(a,typeof e!="symbol"?e+"":e,r);class w extends AudioWorkletProcessor{constructor(r){super();o(this,"len");o(this,"bufs",[]);o(this,"dcX",[]);o(this,"dcY",[]);o(this,"writeIdx",0);o(this,"dcR",1-2*Math.PI*5/sampleRate);const f=Math.min(5,r?.processorOptions?.maxPeriod??.1);this.len=Math.ceil(f*sampleRate)+4}static get parameterDescriptors(){return[{name:"period",defaultValue:.005,minValue:0,maxValue:5,automationRate:"a-rate"},{name:"feedback",defaultValue:.7,minValue:0,maxValue:.95,automationRate:"a-rate"}]}process(r,f,_){const g=r[0]??[],i=f[0];if(!i||!i.length)return!0;const h=_.period,I=_.feedback,s=this.len,A=i[0].length,E=this.writeIdx;for(let t=0;t<i.length;t++){const u=this.bufs[t]??(this.bufs[t]=new Float32Array(s));let P=this.dcX[t]??0,b=this.dcY[t]??0;const x=g[t],F=i[t];let c=E;for(let n=0;n<A;n++){const y=h.length>1?h[n]:h[0],O=I.length>1?I[n]:I[0];let l=y*sampleRate;l<1?l=1:l>s-2&&(l=s-2);let p=c-l;p<0&&(p+=s);const d=p|0,v=p-d,C=d+1===s?0:d+1,R=u[d]+v*(u[C]-u[d]),D=R-P+this.dcR*b;P=R,b=D;let m=(x?x[n]:0)+O*D;m>-1e-20&&m<1e-20&&(m=0),u[c]=m,c=c+1===s?0:c+1,F[n]=R}this.dcX[t]=P,this.dcY[t]=b}return this.writeIdx=(E+A)%s,!0}}registerProcessor("comb-filter",w);})();\n';
|
|
9
9
|
|
|
10
|
+
// src/lib-runtime/generated/worklet-src/compressor.ts
|
|
11
|
+
var compressor_default = '(()=>{var I=Object.defineProperty;var T=(u,n,r)=>n in u?I(u,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[n]=r;var o=(u,n,r)=>T(u,typeof n!="symbol"?n+"":n,r);const B=Math.LN10/20,S=-120,W=1e-6,j=1/30;class q extends AudioWorkletProcessor{constructor(){super();o(this,"y1",0);o(this,"yL",0);o(this,"lastAtk",-1);o(this,"lastRel",-1);o(this,"aA",0);o(this,"aR",0);o(this,"meterPeriod");o(this,"meterCountdown");o(this,"meterMax",0);this.meterPeriod=Math.max(1,Math.round(j*sampleRate)),this.meterCountdown=this.meterPeriod}static get parameterDescriptors(){return[{name:"threshold",defaultValue:-24,minValue:-60,maxValue:0,automationRate:"a-rate"},{name:"ratio",defaultValue:4,minValue:1,maxValue:20,automationRate:"a-rate"},{name:"attack",defaultValue:.003,minValue:1e-4,maxValue:1,automationRate:"a-rate"},{name:"release",defaultValue:.25,minValue:.01,maxValue:1,automationRate:"a-rate"},{name:"knee",defaultValue:10,minValue:0,maxValue:40,automationRate:"a-rate"},{name:"makeup",defaultValue:0,minValue:0,maxValue:30,automationRate:"a-rate"},{name:"keyExt",defaultValue:0,minValue:0,maxValue:1,automationRate:"k-rate"}]}process(r,_,l){const d=r[0],h=_[0];if(!h||h.length===0)return!0;const F=h.length,O=h[0].length,V=d?d.length:0,f=l.keyExt[0]>=.5?r[1]:d,w=f?f.length:0,x=l.threshold,k=l.ratio,g=l.attack,M=l.release,y=l.knee,P=l.makeup;let s=this.yL,e=this.y1;for(let a=0;a<O;a++){const N=x.length>1?x[a]:x[0],b=k.length>1?k[a]:k[0],v=g.length>1?g[a]:g[0],A=M.length>1?M[a]:M[0],p=y.length>1?y[a]:y[0],D=P.length>1?P[a]:P[0];v!==this.lastAtk&&(this.lastAtk=v,this.aA=Math.exp(-1/(v*sampleRate))),A!==this.lastRel&&(this.lastRel=A,this.aR=Math.exp(-1/(A*sampleRate)));let c=0;for(let t=0;t<w;t++){const i=f[t][a],E=i<0?-i:i;E>c&&(c=E)}c>1e5&&(c=1e5);const R=(c>W?20*Math.log10(c):S)-N,L=1-1/b;let m=0;if(p>0&&2*Math.abs(R)<=p){const t=R+p/2;m=L*t*t/(2*p)}else R>0&&(m=L*R);const C=this.aR*e+(1-this.aR)*m;e=m>C?m:C,e<1e-9&&(e=0),s=e>s?this.aA*s+(1-this.aA)*e:e,s>this.meterMax&&(this.meterMax=s);const G=Math.exp((D-s)*B);for(let t=0;t<F;t++){const i=V===0?0:d[t<V?t:V-1][a];h[t][a]=i===i?i*G:0}--this.meterCountdown<=0&&(this.meterCountdown=this.meterPeriod,this.port.postMessage({gr:this.meterMax}),this.meterMax=0)}return this.yL=s===s&&s<1e6?s:0,this.y1=e===e&&e<1e6?e:0,!0}}registerProcessor("compressor",q);})();\n';
|
|
12
|
+
|
|
10
13
|
// src/lib-runtime/generated/worklet-src/env-follower.ts
|
|
11
14
|
var env_follower_default = '(()=>{var d=Object.defineProperty;var h=(t,e,a)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var u=(t,e,a)=>h(t,typeof e!="symbol"?e+"":e,a);class V extends AudioWorkletProcessor{constructor(){super(...arguments);u(this,"envelope",0)}static get parameterDescriptors(){return[{name:"attack",defaultValue:.01,minValue:.001,maxValue:.5,automationRate:"k-rate"},{name:"release",defaultValue:.1,minValue:.001,maxValue:2,automationRate:"k-rate"}]}process(a,f,l){const s=a[0]?.[0],n=f[0]?.[0];if(!s||!n)return!0;const m=l.attack[0],p=l.release[0],k=Math.exp(-1/(m*sampleRate)),v=Math.exp(-1/(p*sampleRate));let o=this.envelope;for(let r=0;r<s.length;r++){const c=Math.abs(s[r]),i=c>o?k:v;o=i*o+(1-i)*c,n[r]=o}return this.envelope=o,!0}}registerProcessor("env-follower",V);})();\n';
|
|
12
15
|
|
|
13
16
|
// src/lib-runtime/generated/worklet-src/fdn-reverb.ts
|
|
14
|
-
var fdn_reverb_default = '(()=>{var
|
|
17
|
+
var fdn_reverb_default = '(()=>{var a0=Object.defineProperty;var r0=(u,m,n)=>m in u?a0(u,m,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[m]=n;var a=(u,m,n)=>r0(u,typeof m!="symbol"?m+"":m,n);const o0=[32.479167,32.645833,39.354167,37.979167,44.854167,46.729167,54.854167,54.020833,64.354167,65.020833,77.770833,76.229167,90.770833,91.854167,108.520833,108.270833],i=16,f=8,n0=[5,1.7],i0=[4.3,2.3],D=.5,J=1e-20,l0=3.3,c0=[.817561207028867,-.020162605572946,-.280270618551673,.023154427018164,-.040757497055389,.271796994004439,-.215897560174333,-.360489748784673,-.049279591845978,.496772123749905,.239792015353202,.383676880593258,-.184295710809704,.177676153912478,.520261429529717,-.458121315608967,.203489837315167,.614979612632778,.411227141461452,-.272758369017431,.436125293734819,.156096498997167,-.206758795481998,.282075316304454,.083237224745128,-.365604936961846,.479176578254122,-.175074003367075,-.395365728139379,.603943872506805,.134571883507736,.244891083396342,.212652562623983,-.476634014014298,.412616312008971,.089951269420676,.601992674099166,-.206663542542475,.311768980659393,-.216680769107754,.196676057177205,.093702545009867,-.314101445638344,-.596461670233581,-.031172939118355,-.126040534115335,.677428910755943,.14947983770607,.217781344860184,.009904403567404,-.24067985977584,.61256473635221,.150236765631027,.124750024459399,.25055095459946,.646839549112683,-.386648867952236,-.069898390896701,-.372010054619396,-.090080953220904,.481577168311424,.656722662609131,.054515042276406,-.181487450068921],h0=[-.439183217955082,-.307180489388576,-.001883582829926,-.325269531876941,.481212433268578,.473987200110376,.385696540730922,.044309574827043,-.743451734053274,-.051194577718082,-.444310999424193,-.068361324490184,-.34422386219065,-.302254563257225,-.156628949916081,.090512889617952,-.026513565311469,.086180510526682,-.240110887817448,.472502374014231,-.3649700280918,.29441974997423,.575260386278348,-.400184452422801,-.35031658889868,.550718164095976,.613748317273311,-.241201396723834,-.097299427357903,-.140520186326495,.166325223750096,-.286784761022745,.007630930996236,.146160866160651,-.025038835302295,.241738383750083,.279944636827771,-.521782099124051,.563150200067307,.501747619977534,.235033344317715,-.533857486836061,.087784021762389,-.474270156610857,-.328325006860238,-.383627102128702,.349647699653538,-.22337573142353,.209998561591045,.435210654029665,-.590338518110587,-.3973215398565,.327777471710569,-.14199393442113,.054674862535641,-.359914753494717,.177692539734562,.310687233504542,-.106824195700287,-.408479889409701,-.46224435747492,.371430762478326,.160424300333846,.562374396599422],p0=[.37,.535248,.700495,.865743],f0=[.802624,.967871,.433119,.598367],u0=[0,2,4,6],m0=[0,4,8,12],K=500,M0=.0379;function A0(u,m){const n=1-u;if(n<1e-12)return 0;const M=1-u*Math.cos(2*Math.PI*m/sampleRate);return(M-Math.sqrt(Math.max(0,M*M-n*n)))/n}function z(u,m){const n=1-u,M=2*Math.PI*m/sampleRate;return u/Math.sqrt(1-2*n*Math.cos(M)+n*n)}class d0 extends AudioWorkletProcessor{constructor(n){super();a(this,"bufs",[]);a(this,"lens",new Int32Array(i));a(this,"idx",new Int32Array(i));a(this,"delaySec",new Float64Array(i));a(this,"nStages",new Int32Array(i));a(this,"frac",new Float64Array(i));a(this,"maxStages",0);a(this,"lp",new Float64Array(0));a(this,"lpF",new Float64Array(i));a(this,"y",new Float64Array(i));a(this,"sum",new Float64Array(f));a(this,"dif",new Float64Array(f));a(this,"apBuf",[]);a(this,"apLen",[]);a(this,"apIdx",[0,0]);a(this,"sApBuf",[]);a(this,"sApLen",[]);a(this,"sApIdx",[0,0]);a(this,"ceiling");a(this,"rc",new Float64Array(f));a(this,"rs",new Float64Array(f));a(this,"stepC",new Float64Array(f));a(this,"stepS",new Float64Array(f));a(this,"g",new Float64Array(i));a(this,"gTarget",new Float64Array(i));a(this,"lpCoef",0);a(this,"fracCoef",new Float64Array(i));a(this,"fracTarget",new Float64Array(i));a(this,"primed",!1);const M=n?.processorOptions?.size??1;this.ceiling=n?.processorOptions?.feedbackCeiling??.995;for(let s=0;s<i;s++){const l=Math.max(2,Math.round(o0[s]/1e3*M*sampleRate));this.lens[s]=l,this.delaySec[s]=l/sampleRate,this.bufs.push(new Float32Array(l));const h=this.delaySec[s]/M0;this.nStages[s]=Math.floor(h),this.frac[s]=h-Math.floor(h),this.maxStages=Math.max(this.maxStages,this.nStages[s])}this.lp=new Float64Array(i*Math.max(1,this.maxStages));for(let s=0;s<2;s++){const l=Math.max(2,Math.round(n0[s]/1e3*sampleRate));this.apLen.push(l),this.apBuf.push(new Float32Array(l));const h=Math.max(2,Math.round(i0[s]/1e3*sampleRate));this.sApLen.push(h),this.sApBuf.push(new Float32Array(h))}for(let s=0;s<f;s++){const l=s<4?p0[s]:f0[s-4],h=s<4?u0[s]:m0[s-4];this.rc[s]=Math.cos(h),this.rs[s]=Math.sin(h);const S=2*Math.PI*l/sampleRate;this.stepC[s]=Math.cos(S),this.stepS[s]=Math.sin(S)}}static get parameterDescriptors(){return[{name:"rt60",defaultValue:2,minValue:.05,maxValue:30,automationRate:"k-rate"},{name:"damping",defaultValue:.55,minValue:0,maxValue:1,automationRate:"k-rate"}]}updateTargets(n,M,s){const l=Math.max(n,.05),h=Math.min(2*s,.45*sampleRate),S=z(M,h)**2,A=z(M,K);for(let d=0;d<i;d++){const k=1-A0(Math.pow(S,this.frac[d]),h);this.fracTarget[d]=k;const E=Math.pow(A,this.nStages[d])*z(k,K);this.gTarget[d]=Math.min(Math.pow(10,-3*this.delaySec[d]/l)/E,this.ceiling)}}process(n,M,s){const l=M[0];if(!l||!l[0])return!0;const h=l[0],S=h.length,A=n[0],d=s.rt60[0],k=s.damping[0],E=800*Math.pow(20,Math.max(0,Math.min(1,k))),B=1-Math.exp(-2*Math.PI*E/sampleRate);this.updateTargets(d,B,E);const L=this.g,Q=this.gTarget,O=this.fracCoef,j=this.fracTarget;if(!this.primed){for(let e=0;e<i;e++)L[e]=Q[e],O[e]=j[e];this.lpCoef=B,this.primed=!0}const H=.15;for(let e=0;e<i;e++)L[e]+=(Q[e]-L[e])*H,O[e]+=(j[e]-O[e])*H;this.lpCoef+=(B-this.lpCoef)*H;const N=this.bufs,Y=this.lens,v=this.idx,$=this.lpCoef,b=this.lp,T=this.lpF,t0=this.nStages,e0=Math.max(1,this.maxStages),P=this.y,w=this.sum,x=this.dif,y=this.rc,F=this.rs,q=this.stepC,U=this.stepS,Z=l.length>1?l[1]:null,s0=!!(A&&A.length>1),G=l0*2/i;for(let e=0;e<S;e++){let R=0,V=0;A&&A.length&&(s0?(R=A[0][e],V=A[1][e]):R=V=A[0][e]);for(let t=0;t<i;t++){let o=N[t][v[t]];const r=t*e0;for(let c=0;c<t0[t];c++){const p=b[r+c]+(o-b[r+c])*$;b[r+c]=p,o=p}T[t]+=(o-T[t])*O[t],P[t]=T[t]*L[t]}let _=0,I=0;for(let t=0;t<f;t++)_+=P[2*t],I+=P[2*t+1];_*=G,I*=G;for(let t=0;t<f;t++){const o=P[2*t],r=P[2*t+1];w[t]=(o+r)*Math.SQRT1_2,x[t]=(o-r)*Math.SQRT1_2}for(let t=0;t<4;t++){const o=y[t],r=F[t],c=w[2*t],p=w[2*t+1];w[2*t]=o*c-r*p,w[2*t+1]=r*c+o*p;const C=y[t+4],g=F[t+4],X=x[2*t],W=x[2*t+1];x[2*t]=C*X-g*W,x[2*t+1]=g*X+C*W}for(let t=0;t<f;t++){const o=y[t],r=F[t];y[t]=o*q[t]-r*U[t],F[t]=r*q[t]+o*U[t]}for(let t=0;t<f;t++){let o=0,r=0;const c=t*f;for(let g=0;g<f;g++)o+=c0[c+g]*w[g],r+=h0[c+g]*x[g];const p=2*t,C=p+1;N[p][v[p]]=R+(o+r)*Math.SQRT1_2,N[C][v[C]]=V+(o-r)*Math.SQRT1_2}for(let t=0;t<i;t++)v[t]=v[t]+1===Y[t]?0:v[t]+1;for(let t=0;t<2;t++){const o=this.apBuf[t],r=this.apIdx[t],c=o[r],p=_+c*D;o[r]=p,_=c-p*D,this.apIdx[t]=r+1===this.apLen[t]?0:r+1}for(let t=0;t<2;t++){const o=this.sApBuf[t],r=this.sApIdx[t],c=o[r],p=I+c*D;o[r]=p,I=c-p*D,this.sApIdx[t]=r+1===this.sApLen[t]?0:r+1}Z?(h[e]=_,Z[e]=I):h[e]=.5*(_+I)}for(let e=0;e<f;e++){const R=1/Math.sqrt(y[e]*y[e]+F[e]*F[e]);y[e]*=R,F[e]*=R}for(let e=0;e<b.length;e++)Math.abs(b[e])<J&&(b[e]=0);for(let e=0;e<i;e++)Math.abs(T[e])<J&&(T[e]=0);for(let e=2;e<l.length;e++)l[e].set(l[e&1]);return!0}}registerProcessor("fdn-reverb",d0);})();\n';
|
|
15
18
|
|
|
16
19
|
// src/lib-runtime/generated/worklet-src/flanger.ts
|
|
17
20
|
var flanger_default = '(()=>{var D=Object.defineProperty;var P=(r,e,i)=>e in r?D(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i;var a=(r,e,i)=>P(r,typeof e!="symbol"?e+"":e,i);const M=.009000000000000001,p=class p extends AudioWorkletProcessor{constructor(){super(...arguments);a(this,"bufs",[]);a(this,"writeIdx",0);a(this,"phase",0);a(this,"dcX",[]);a(this,"dcY",[]);a(this,"dcR",1-2*Math.PI*5/sampleRate)}static get parameterDescriptors(){return[{name:"rate",defaultValue:.5,minValue:.05,maxValue:10,automationRate:"a-rate"},{name:"depth",defaultValue:.7,minValue:0,maxValue:1,automationRate:"a-rate"},{name:"feedback",defaultValue:.7,minValue:0,maxValue:.95,automationRate:"a-rate"}]}process(i,E,f){const x=i[0]??[],c=E[0]??[];if(!c.length)return!0;const V=c[0].length,m=f.rate,S=f.depth,A=f.feedback,n=p.LEN,R=c.length;for(;this.bufs.length<R;)this.bufs.push(new Float32Array(n)),this.dcX.push(0),this.dcY.push(0);for(let s=0;s<V;s++){const _=m.length>1?m[s]:m[0],w=S.length>1?S[s]:S[0],Y=A.length>1?A[s]:A[0];let h=(.005+w*.004*Math.sin(2*Math.PI*this.phase))*sampleRate;h<1?h=1:h>n-2&&(h=n-2);let l=this.writeIdx-h;l<0&&(l+=n);const o=l|0,v=l-o,L=o+1===n?0:o+1;for(let t=0;t<R;t++){const d=this.bufs[t],g=x[t]??x[0],b=d[o]+v*(d[L]-d[o]),y=b-this.dcX[t]+this.dcR*this.dcY[t];this.dcX[t]=b,this.dcY[t]=y;let u=(g?g[s]:0)+Y*y;u>-1e-20&&u<1e-20&&(u=0),d[this.writeIdx]=u,c[t][s]=b}this.writeIdx=this.writeIdx+1===n?0:this.writeIdx+1,this.phase+=_/sampleRate,this.phase>=1&&(this.phase-=1)}return!0}};a(p,"LEN",Math.ceil(M*sampleRate)+8);let I=p;registerProcessor("flanger",I);})();\n';
|
|
18
21
|
|
|
19
22
|
// src/lib-runtime/generated/worklet-src/formant-table.ts
|
|
20
|
-
var formant_table_default = '(()=>{const
|
|
23
|
+
var formant_table_default = '(()=>{const M=[[800,1200,2500,3300,3750],[400,2e3,2800,3500,4500],[300,2300,3e3,3500,4500],[500,900,2500,3300,3750],[350,700,2500,3300,3750]],A=[[80,90,120,130,140],[60,80,120,150,200],[50,100,120,150,200],[70,80,100,130,135],[50,60,170,180,200]],a=6,W=5.2;class x extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"baseMorph",defaultValue:0,automationRate:"k-rate"},{name:"resonance",defaultValue:a,minValue:1,maxValue:20,automationRate:"k-rate"}]}process(d,g,c){const l=d[0],o=g[0],u=l.length>0?l[0]:null,R=c.baseMorph[0],i=Math.min(20,Math.max(1,c.resonance[0])),V=a/i,k=W*Math.sqrt(i/a),e=o.length;if(!o[0])return!0;const E=o[0].length;for(let n=0;n<E;n++){const F=u?u[n]:0,r=((R+F)%5+5)%5,s=Math.floor(r)%5,f=(s+1)%5,h=r-Math.floor(r),m=M[s],L=M[f],p=A[s],w=A[f];for(let t=0;t<5;t++){const b=m[t]+(L[t]-m[t])*h,P=(p[t]+(w[t]-p[t])*h)*V;t<e&&(o[t][n]=b),t+5<e&&(o[t+5][n]=b/P)}e>10&&(o[10][n]=k)}return!0}}registerProcessor("formant-table",x);})();\n';
|
|
21
24
|
|
|
22
25
|
// src/lib-runtime/generated/worklet-src/freq-divider.ts
|
|
23
26
|
var freq_divider_default = '(()=>{var F=Object.defineProperty;var b=(a,e,i)=>e in a?F(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i;var t=(a,e,i)=>b(a,typeof e!="symbol"?e+"":e,i);class w extends AudioWorkletProcessor{constructor(){super(...arguments);t(this,"prevSample",0);t(this,"div1State",!1);t(this,"div2Count",0);t(this,"div2State",!1);t(this,"envelope",0);t(this,"smoothGate",0);t(this,"samplesSinceCross",0);t(this,"freqEstimate",0)}static get parameterDescriptors(){return[{name:"oct1Level",defaultValue:.5,minValue:0,maxValue:1,automationRate:"k-rate"},{name:"oct2Level",defaultValue:.3,minValue:0,maxValue:1,automationRate:"k-rate"}]}process(i,o,h){const r=i[0]?.[0],v=o[0]?.[0],p=o[1],m=o[2]?.[0];if(!r)return!0;const g=h.oct1Level[0],q=h.oct2Level[0],G=.01,V=.01,R=5e-4,A=.02,E=.002,f=p?.[0],u=p?.[1];for(let s=0;s<r.length;s++){const n=r[s],l=Math.abs(n);if(l>this.envelope?this.envelope+=V*(l-this.envelope):this.envelope+=R*(l-this.envelope),this.samplesSinceCross++,this.prevSample<=0&&n>0){if(this.div1State=!this.div1State,this.div2Count++,this.div2Count>=2&&(this.div2State=!this.div2State,this.div2Count=0),this.samplesSinceCross>4&&this.samplesSinceCross<sampleRate){const k=sampleRate/this.samplesSinceCross;this.freqEstimate+=.05*(k-this.freqEstimate)}this.samplesSinceCross=0}this.prevSample=n;const d=this.envelope>G?1:0,L=d>this.smoothGate?A:E;this.smoothGate+=L*(d-this.smoothGate);const S=this.div1State?1:-1,C=this.div2State?1:-1,c=this.smoothGate*this.envelope;v&&(v[s]=(S*g+C*q)*c),f&&(f[s]=S*c),u&&(u[s]=C*c),m&&(m[s]=this.freqEstimate*this.smoothGate)}return!0}}registerProcessor("freq-divider",w);})();\n';
|
|
@@ -25,6 +28,9 @@ var freq_divider_default = '(()=>{var F=Object.defineProperty;var b=(a,e,i)=>e i
|
|
|
25
28
|
// src/lib-runtime/generated/worklet-src/freq-shifter.ts
|
|
26
29
|
var freq_shifter_default = '(()=>{var q=Object.defineProperty;var B=(r,t,s)=>t in r?q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>B(r,typeof t!="symbol"?t+"":t,s);const C=[.6923877778065,.9360654322959,.988229522686,.9987488452737],S=[.4021921162426,.856171088242,.9722909545651,.9952884791278];class m{constructor(t){e(this,"a2");e(this,"x1",0);e(this,"x2",0);e(this,"y1",0);e(this,"y2",0);this.a2=t}process(t){const s=this.a2*(t+this.y2)-this.x2;return this.x2=this.x1,this.x1=t,this.y2=this.y1,this.y1=s,s}}class w extends AudioWorkletProcessor{constructor(){super(...arguments);e(this,"branchA",C.map(s=>new m(s)));e(this,"branchB",S.map(s=>new m(s)));e(this,"delayA",0);e(this,"phase",0)}static get parameterDescriptors(){return[{name:"shift",defaultValue:0,minValue:-8e3,maxValue:8e3,automationRate:"a-rate"}]}process(s,y,A){const u=s[0]?.[0],n=y[0]?.[0];if(!n)return!0;if(!u)return n.fill(0),!0;const o=A.shift,c=2*Math.PI,b=c/sampleRate;for(let i=0;i<n.length;i++){const h=o.length>1?o[i]:o[0],v=h<0?-1:1,g=h<0?-h:h,f=u[i];let p=f;for(let a=0;a<this.branchA.length;a++)p=this.branchA[a].process(p);let l=f;for(let a=0;a<this.branchB.length;a++)l=this.branchB[a].process(l);const x=this.delayA,F=l;this.delayA=p,this.phase+=b*g,this.phase>=c&&(this.phase-=c);const d=Math.cos(this.phase),P=Math.sin(this.phase);n[i]=x*d+v*F*P}return!0}}registerProcessor("freq-shifter",w);})();\n';
|
|
27
30
|
|
|
31
|
+
// src/lib-runtime/generated/worklet-src/gate.ts
|
|
32
|
+
var gate_default = '(()=>{var F=Object.defineProperty;var I=(o,e,a)=>e in o?F(o,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[e]=a;var h=(o,e,a)=>I(o,typeof e!="symbol"?e+"":e,a);class P extends AudioWorkletProcessor{constructor(){super(...arguments);h(this,"detectorEnv",0);h(this,"gain",0);h(this,"isOpen",!1)}static get parameterDescriptors(){return[{name:"threshold",defaultValue:-40,minValue:-60,maxValue:0,automationRate:"k-rate"},{name:"range",defaultValue:.8,minValue:0,maxValue:1,automationRate:"k-rate"},{name:"attack",defaultValue:.005,minValue:.001,maxValue:.05,automationRate:"k-rate"},{name:"release",defaultValue:.1,minValue:.01,maxValue:.5,automationRate:"k-rate"},{name:"keyExt",defaultValue:0,minValue:0,maxValue:1,automationRate:"k-rate"}]}process(a,k,s){const f=a[0],l=k[0];if(!l||l.length===0)return!0;const m=f?f.length:0,x=l.length,d=s.keyExt[0]>=.5?a[1]:f,T=d?d.length:0,C=l[0].length,V=s.threshold[0],v=s.range[0],A=s.attack[0],M=s.release[0],S=Math.pow(10,V/20),y=Math.pow(10,(V-2)/20),D=1-v,p=Math.exp(-1/(.001*sampleRate)),O=Math.exp(-1/(A*sampleRate)),_=Math.exp(-1/(M*sampleRate));let r=this.detectorEnv,c=this.gain,i=this.isOpen;for(let u=0;u<C;u++){let g=0;for(let t=0;t<T;t++){const n=Math.abs(d[t][u]);n>g&&(g=n)}r=p*r+(1-p)*g,i?r<y&&(i=!1):r>S&&(i=!0);const E=i?1:D,R=E>c?O:_;c=R*c+(1-R)*E;for(let t=0;t<x;t++){const n=m===0?0:f[t<m?t:m-1][u];l[t][u]=n===n?n*c:0}}return this.detectorEnv=r,this.gain=c,this.isOpen=i,!0}}registerProcessor("gate",P);})();\n';
|
|
33
|
+
|
|
28
34
|
// src/lib-runtime/generated/worklet-src/glide.ts
|
|
29
35
|
var glide_default = '(()=>{var m=Object.defineProperty;var v=(r,t,e)=>t in r?m(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>v(r,typeof t!="symbol"?t+"":t,e);class f extends AudioWorkletProcessor{constructor(){super(...arguments);s(this,"y",0);s(this,"initialized",!1);s(this,"prevGate",-1)}static get parameterDescriptors(){return[{name:"time",defaultValue:.1}]}process(e,p,u){const n=e[0]?.[0],l=e[1]?.[0],a=p[0]?.[0];if(!n||!a)return!0;const o=u.time;for(let i=0;i<a.length;i++){const c=n[i],d=o.length>1?o[i]:o[0],h=l?l[i]:-1,g=1-Math.exp(-3/(sampleRate*Math.max(d,1e-4))),y=h>0&&this.prevGate<=0;!this.initialized||y?(this.y=c,this.initialized=!0):this.y+=g*(c-this.y),this.prevGate=h,a[i]=this.y}return!0}}registerProcessor("glide",f);})();\n';
|
|
30
36
|
|
|
@@ -46,6 +52,9 @@ var ping_pong_default = '(()=>{var I=Object.defineProperty;var k=(s,e,n)=>e in s
|
|
|
46
52
|
// src/lib-runtime/generated/worklet-src/pitch-shifter.ts
|
|
47
53
|
var pitch_shifter_default = '(()=>{var R=Object.defineProperty;var y=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);class E extends AudioWorkletProcessor{constructor(t){super();r(this,"ring");r(this,"ringLen");r(this,"writePos",0);r(this,"readPos");r(this,"grainPhase");r(this,"grainLen");r(this,"jitterLen");r(this,"rng");this.rng=(t?.processorOptions?.seed??2654435769)>>>0||1,this.jitterLen=Math.round(sampleRate*.01),this.ringLen=Math.ceil(sampleRate*1),this.ring=new Float32Array(this.ringLen),this.grainLen=Math.floor(sampleRate*.08),this.readPos=new Float64Array([0,0]),this.grainPhase=new Float64Array([0,.5]),this.readPos[0]=this.readPos[1]=this.ringLen-this.grainLen}static get parameterDescriptors(){return[{name:"semitones",defaultValue:12,minValue:-24,maxValue:24,automationRate:"k-rate"}]}rand(){let t=this.rng;return t^=t<<13,t^=t>>>17,t^=t<<5,this.rng=t>>>0,this.rng/4294967296}process(t,P,p){const h=t[0]?.[0],o=P[0]?.[0];if(!o)return!0;const d=p.semitones[0],c=Math.pow(2,d/12),u=1/this.grainLen,L=2*Math.PI;for(let n=0;n<o.length;n++){const m=h?h[n]:0;this.ring[this.writePos]=m;let g=0;for(let s=0;s<2;s++){if(this.grainPhase[s]+=u,this.grainPhase[s]>=1){this.grainPhase[s]-=1;const f=Math.max(0,c-1)*this.grainLen+2+this.rand()*this.jitterLen;this.readPos[s]=(this.writePos-f+this.ringLen)%this.ringLen}else this.readPos[s]+=c,this.readPos[s]>=this.ringLen?this.readPos[s]-=this.ringLen:this.readPos[s]<0&&(this.readPos[s]+=this.ringLen);const l=this.readPos[s],a=l|0,A=l-a,S=(a+1)%this.ringLen,w=this.ring[a]+A*(this.ring[S]-this.ring[a]),N=.5-.5*Math.cos(L*this.grainPhase[s]);g+=w*N}o[n]=g,this.writePos=this.writePos+1===this.ringLen?0:this.writePos+1}return!0}}registerProcessor("pitch-shifter",E);})();\n';
|
|
48
54
|
|
|
55
|
+
// src/lib-runtime/generated/worklet-src/shaper.ts
|
|
56
|
+
var shaper_default = '(()=>{var b=Object.defineProperty;var g=(l,h,r)=>h in l?b(l,h,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[h]=r;var i=(l,h,r)=>g(l,typeof h!="symbol"?h+"":h,r);const F=[.02715585672648318,.10300238556004077,.21303004592041422,.33933626891036295,.46602752012040527,.5822470138570043,.6825907648523519,.7659552823868774,.8339692410251047,.8896926536875072,.9368031111658155,.9792387297342222],A=[],p=[];for(let l=0;l<F.length;l++)(l%2===0?A:p).push(F[l]);const d=A.length,f=p.length;function y(l,h,r,t){for(let e=0;e<h;e++){const n=e*2,s=l[e]*(t-r[n+1])+r[n];r[n]=t,r[n+1]=s,t=s}return t}class m{constructor(){i(this,"upA",new Float64Array(d*2));i(this,"upB",new Float64Array(f*2));i(this,"dnA",new Float64Array(d*2));i(this,"dnB",new Float64Array(f*2));i(this,"dUpA",new Float64Array(d*2));i(this,"dUpB",new Float64Array(f*2));i(this,"dDnA",new Float64Array(d*2));i(this,"dDnB",new Float64Array(f*2));i(this,"u1",0);i(this,"F1",0);i(this,"d1",0)}}class w extends AudioWorkletProcessor{constructor(r){super();i(this,"curve",new Float64Array([-1,1]));i(this,"prim",new Float64Array([0,0]));i(this,"h",2);i(this,"lanes",[new m,new m]);i(this,"withDry",!0);this.withDry=r?.processorOptions?.dry!==!1;const t=r?.processorOptions?.curve;t&&t.length>=2&&this.setCurve(t),this.port.onmessage=e=>{const n=e.data;n?.curve&&n.curve.length>=2&&this.setCurve(n.curve)}}setCurve(r){const t=r.length,e=new Float64Array(t);let n=0;for(let o=0;o<t;o++){const a=r[o];e[o]=Number.isFinite(a)?n=a:n}const s=2/(t-1),c=new Float64Array(t);for(let o=1;o<t;o++)c[o]=c[o-1]+.5*s*(e[o-1]+e[o]);this.curve=e,this.prim=c,this.h=s;for(const o of this.lanes)o.F1=this.F(o.u1)}f(r){const t=this.curve,e=t.length,n=(r+1)*.5*(e-1);if(n<=0)return t[0];if(n>=e-1)return t[e-1];const s=Math.floor(n),c=n-s;return t[s]+(t[s+1]-t[s])*c}F(r){const t=this.curve,e=this.prim,n=t.length,s=this.h,c=(r+1)*.5*(n-1);if(c<=0)return(r+1)*t[0];if(c>=n-1)return e[n-1]+(r-1)*t[n-1];const o=Math.floor(c),a=c-o;return e[o]+s*(t[o]*a+.5*(t[o+1]-t[o])*a*a)}adaa(r,t){const e=this.F(t),n=t-r.u1,s=Math.abs(n)>1e-7?(e-r.F1)/n:this.f(.5*(t+r.u1));return r.u1=t,r.F1=e,s}runWet(r,t,e){const n=e.length;for(let s=0;s<n;s++){const c=t?t[s]:0,o=y(A,d,r.upA,c),a=y(p,f,r.upB,c),u=this.adaa(r,o),v=this.adaa(r,a);e[s]=.5*(y(A,d,r.dnA,v)+y(p,f,r.dnB,u))}}runDry(r,t,e){const n=e.length;for(let s=0;s<n;s++){const c=t?t[s]:0,o=y(A,d,r.dUpA,c),a=y(p,f,r.dUpB,c),u=.5*(o+r.d1),v=.5*(a+o);r.d1=a,e[s]=.5*(y(A,d,r.dDnA,v)+y(p,f,r.dDnB,u))}}process(r,t){const e=r[0]??[],n=r[1]&&r[1].length>0?r[1]:e,s=t[0]??[],c=this.withDry?t[1]??[]:[];if(s.length===0)return!0;const o=e.length>=2?2:1;for(let a=0;a<o;a++)this.runWet(this.lanes[a],e[a],s[a]??s[0]);if(o===1)for(let a=1;a<s.length;a++)s[a].set(s[0]);if(c.length>0){const a=n.length>=2?2:1;for(let u=0;u<a;u++)this.runDry(this.lanes[u],n[u],c[u]??c[0]);if(a===1)for(let u=1;u<c.length;u++)c[u].set(c[0])}return!0}}registerProcessor("shaper",w);})();\n';
|
|
57
|
+
|
|
49
58
|
// src/lib-runtime/generated/worklet-src/spring-reverb.ts
|
|
50
59
|
var spring_reverb_default = '(()=>{var $=Object.defineProperty;var tt=(n,o,e)=>o in n?$(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e;var s=(n,o,e)=>tt(n,typeof o!="symbol"?o+"":o,e);const c=[{stages:76,delayMs:37.9,chan:0},{stages:90,delayMs:41.7,chan:1},{stages:82,delayMs:51.3,chan:0},{stages:96,delayMs:47.9,chan:1}],b=c.length,st=.7,N=.95,et=2.4,at=4,nt=150,ot=15,it=.98,rt=1e-20,ct=500;function ht(n){if(n>3)return 1;if(n<-3)return-1;const o=n*n;return n*(27+o)/(27+9*o)}class pt extends AudioWorkletProcessor{constructor(){super();s(this,"apX",[]);s(this,"apY",[]);s(this,"dBuf",[]);s(this,"dLen",[]);s(this,"dIdx",[]);s(this,"fb",[]);s(this,"lp",[]);s(this,"dc",[]);s(this,"g",[]);s(this,"inHpState",0);s(this,"inHpCoef");s(this,"dcCoef");s(this,"a",.56);s(this,"lpCoef",.4);s(this,"knockPos",-1);s(this,"knockLen");s(this,"prevTrig",0);for(let e=0;e<b;e++){this.apX.push(new Float32Array(c[e].stages)),this.apY.push(new Float32Array(c[e].stages));const p=Math.max(2,Math.round(c[e].delayMs/1e3*sampleRate));this.dLen.push(p),this.dBuf.push(new Float32Array(p)),this.dIdx.push(0),this.fb.push(0),this.lp.push(0),this.dc.push(0),this.g.push(0)}this.inHpCoef=1-Math.exp(-2*Math.PI*nt/sampleRate),this.dcCoef=1-Math.exp(-2*Math.PI*ot/sampleRate),this.knockLen=Math.max(8,Math.round(at/1e3*sampleRate))}static get parameterDescriptors(){return[{name:"decay",defaultValue:1.5,minValue:.3,maxValue:4,automationRate:"k-rate"},{name:"tone",defaultValue:.6,minValue:0,maxValue:1,automationRate:"k-rate"},{name:"drip",defaultValue:.5,minValue:0,maxValue:1,automationRate:"k-rate"}]}process(e,p,m){const h=p[0];if(!h||!h[0])return!0;const x=h[0],w=h[1]??h[0],O=x.length,M=e[0]?.[0],E=e[0]?.[1]??M,I=e[1]?.[0],B=m.decay[0],D=Math.max(0,Math.min(1,m.tone[0])),K=.35+.42*Math.max(0,Math.min(1,m.drip[0]));this.a+=(K-this.a)*.1;const i=this.a,X=1100*Math.pow(6500/1100,D),g=1-Math.exp(-2*Math.PI*X/sampleRate);this.lpCoef+=(g-this.lpCoef)*.15;const Y=this.lpCoef,L=2*Math.PI*ct/sampleRate,k=Math.cos(L),Z=(1-i*i)/(1-2*i*k+i*i),v=1-g,G=g/Math.sqrt(1-2*v*k+v*v),A=1-this.dcCoef,y=1-A*k,C=A*Math.sin(L),H=y*y+C*C,q=1-this.dcCoef*y/H,z=this.dcCoef*C/H,J=G*Math.hypot(q,z);for(let a=0;a<b;a++){const l=(this.dLen[a]+c[a].stages*Z)/sampleRate,u=Math.min(Math.pow(10,-3*l/Math.max(B,.05))/J,it);this.g[a]+=(u-this.g[a])*.15}const U=this.inHpCoef,W=this.dcCoef;for(let a=0;a<O;a++){if(I){const t=I[a];t>.5&&this.prevTrig<=.5&&(this.knockPos=0),this.prevTrig=t}const l=M?(M[a]+E[a])*.5:0;this.inHpState+=U*(l-this.inHpState);let u=(l-this.inHpState)*st;this.knockPos>=0&&(u+=Math.sin(Math.PI*this.knockPos/this.knockLen)*et,++this.knockPos>=this.knockLen&&(this.knockPos=-1));let F=0,S=0;for(let t=0;t<b;t++){let d=u+this.fb[t]+rt;const R=this.apX[t],T=this.apY[t],j=R.length;for(let r=0;r<j;r++){const V=-i*d+R[r]+i*T[r];R[r]=d,T[r]=V,d=V}const _=this.dBuf[t],f=this.dIdx[t],Q=_[f];_[f]=d,this.dIdx[t]=f+1>=this.dLen[t]?0:f+1,this.lp[t]+=Y*(Q-this.lp[t]),this.dc[t]+=W*(this.lp[t]-this.dc[t]);const P=ht(this.lp[t]-this.dc[t]);this.fb[t]=P*this.g[t],c[t].chan===0?F+=P:S+=P}x[a]=F*N,w[a]=S*N}return!0}}registerProcessor("spring-reverb",pt);})();\n';
|
|
51
60
|
|
|
@@ -53,11 +62,14 @@ var spring_reverb_default = '(()=>{var $=Object.defineProperty;var tt=(n,o,e)=>o
|
|
|
53
62
|
var tape_delay_default = '(()=>{var L=Object.defineProperty;var Z=(s,e,t)=>e in s?L(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>Z(s,typeof e!="symbol"?e+"":e,t);function E(s){let e=s>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}class O extends AudioWorkletProcessor{constructor(){super(...arguments);a(this,"buf",new Float32Array(Math.ceil(1.5*1.03*sampleRate)+4));a(this,"writeIdx",0);a(this,"tSlew",-1);a(this,"slewA",1-Math.exp(-1/(.08*sampleRate)));a(this,"phaseWow",0);a(this,"phaseFlut",0);a(this,"wowInc",2*Math.PI*.85/sampleRate);a(this,"rand",E(2057179700));a(this,"wander",0);a(this,"wanderTarget",0);a(this,"wanderCountdown",0);a(this,"damp",0);a(this,"dampD",Math.exp(-2*Math.PI*6e3/sampleRate));a(this,"dcX",0);a(this,"dcY",0);a(this,"dcR",1-2*Math.PI*5/sampleRate)}static get parameterDescriptors(){return[{name:"time",defaultValue:.375,minValue:.05,maxValue:1.5,automationRate:"k-rate"},{name:"feedback",defaultValue:.5,minValue:0,maxValue:.95,automationRate:"a-rate"},{name:"saturation",defaultValue:.4,minValue:0,maxValue:1,automationRate:"k-rate"},{name:"flutter",defaultValue:.3,minValue:0,maxValue:1,automationRate:"k-rate"}]}process(t,S,u){const R=t[0]?.[0],p=S[0]?.[0];if(!p)return!0;const b=u.time,f=u.feedback,A=u.saturation,F=u.flutter,o=this.buf,l=o.length,V=this.dampD,g=this.dcR,T=b[0];this.tSlew<0&&(this.tSlew=T);const W=1+A[0]*4,x=F[0];this.wanderCountdown<=0&&(this.wanderTarget=this.rand()*2-1,this.wanderCountdown=Math.round(.5*sampleRate)),this.wanderCountdown-=p.length,this.wander+=.02*(this.wanderTarget-this.wander);const y=2*Math.PI*6.3*(1+.12*this.wander)/sampleRate;let m=this.tSlew,M=this.phaseWow,_=this.phaseFlut,n=this.damp,P=this.dcX,i=this.dcY,r=this.writeIdx;for(let h=0;h<p.length;h++){const C=R?R[h]:0,k=f.length>1?f[h]:f[0];m+=this.slewA*(T-m);let I=0;x>0&&(M+=this.wowInc,_+=y,I=x*(.008*Math.sin(M)+.0015*Math.sin(_)));let c=m*(1+I)*sampleRate;c<1?c=1:c>l-3&&(c=l-3);let w=r-c;w<0&&(w+=l);const d=w|0,D=w-d,X=d+1===l?0:d+1,H=o[d]+(o[X]-o[d])*D;n+=(1-V)*(H-n);const v=(Math.tanh(W*n)+Math.tanh(W*n*.3)*.1)/1.1;i=v-P+g*i,P=v,o[r]=C+k*i,p[h]=v,r++,r===l&&(r=0)}return Math.abs(n)<1e-20&&(n=0),Math.abs(i)<1e-20&&(i=0),this.tSlew=m,this.phaseWow=M,this.phaseFlut=_,this.damp=n,this.dcX=P,this.dcY=i,this.writeIdx=r,!0}}registerProcessor("tape-delay",O);})();\n';
|
|
54
63
|
|
|
55
64
|
// src/lib-runtime/generated/worklet-src/tape-stop.ts
|
|
56
|
-
var tape_stop_default = '(()=>{var
|
|
65
|
+
var tape_stop_default = '(()=>{var A=Object.defineProperty;var F=(r,a,s)=>a in r?A(r,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[a]=s;var t=(r,a,s)=>F(r,typeof a!="symbol"?a+"":a,s);const _=r=>Math.min(1,Math.max(0,r/.05));class O extends AudioWorkletProcessor{constructor(){super();t(this,"bufL");t(this,"bufR");t(this,"bufLen");t(this,"holdLen");t(this,"writePos",0);t(this,"readPos",0);t(this,"speed",1);t(this,"ramping",!1);t(this,"prevTrig",0);t(this,"stopped",!1);t(this,"splice",0);t(this,"spliceLen",1);this.bufLen=Math.ceil(sampleRate*6),this.holdLen=Math.floor(sampleRate*3.9),this.bufL=new Float32Array(this.bufLen),this.bufR=new Float32Array(this.bufLen)}static get parameterDescriptors(){return[{name:"time",defaultValue:.5,minValue:.005,maxValue:4},{name:"mix",defaultValue:1,minValue:0,maxValue:1}]}toggle(){this.stopped=!this.stopped,this.splice=0,this.ramping=!0,this.port.postMessage({type:"state",phase:"ramping"})}lag(){const s=this.writePos-this.readPos;return s<0?s+this.bufLen:s}process(s,m,L){const g=s[0]?.[0],P=s[0]?.[1],b=s[1]?.[0],f=m[0]?.[0],E=m[0]?.[1];if(!f)return!0;const M=!!E,u=L.time,d=L.mix,w=f.length;for(let i=0;i<w;i++){const x=u.length>1?u[i]:u[0],p=d.length>1?d[i]:d[0];if(b){const e=b[i];e>.5&&this.prevTrig<=.5&&this.toggle(),this.prevTrig=e}const n=g?g[i]:0,l=P?P[i]:M?n:0;if(this.ramping){const e=1/Math.max(1,x*sampleRate);this.stopped?(this.speed-=e,this.speed<=0&&(this.speed=0,this.ramping=!1,this.port.postMessage({type:"state",phase:"stopped"}))):(this.speed+=e,this.speed>=1&&(this.speed=1,this.ramping=!1,this.spliceLen=Math.max(1,Math.round(.02*sampleRate)),this.splice=this.spliceLen,this.port.postMessage({type:"state",phase:"playing"})))}const S=this.speed===0&&!this.ramping&&this.lag()>=this.holdLen;S||(this.bufL[this.writePos]=n,this.bufR[this.writePos]=l);let o=0,h=0;if(this.speed>=1&&!this.ramping&&this.splice===0)o=n,h=l,this.readPos=this.writePos;else if(this.speed>0){this.lag()>this.bufLen-4&&(this.readPos=(this.writePos+4)%this.bufLen),this.readPos=(this.readPos+this.speed)%this.bufLen;const e=Math.floor(this.readPos),v=this.readPos-e,R=(e+1)%this.bufLen;o=this.bufL[e]+v*(this.bufL[R]-this.bufL[e]),h=this.bufR[e]+v*(this.bufR[R]-this.bufR[e]);const D=_(this.speed);if(o*=D,h*=D,this.splice>0){const y=1-this.splice/this.spliceLen,c=.5-.5*Math.cos(Math.PI*y);o=o*(1-c)+n*c,h=h*(1-c)+l*c,--this.splice===0&&(this.readPos=this.writePos)}}S||(this.writePos=(this.writePos+1)%this.bufLen),f[i]=n*(1-p)+o*p,M&&(E[i]=l*(1-p)+h*p)}return!0}}registerProcessor("tape-stop",O);})();\n';
|
|
57
66
|
|
|
58
67
|
// src/lib-runtime/generated/worklet-src/vca.ts
|
|
59
68
|
var vca_default = '(()=>{class v extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:"gain",defaultValue:.5,minValue:0,maxValue:2,automationRate:"a-rate"},{name:"cvAmount",defaultValue:1,minValue:-1,maxValue:1,automationRate:"a-rate"},{name:"cv",defaultValue:0,minValue:-1e3,maxValue:1e3,automationRate:"a-rate"}]}process(i,m,o){const l=i[0],e=m[0];if(!e)return!0;const s=o.gain,c=o.cvAmount,r=o.cv,f=e.length,g=e[0]?.length??0;for(let t=0;t<g;t++){const V=s.length>1?s[t]:s[0],h=c.length>1?c[t]:c[0],d=r.length>1?r[t]:r[0];let a=V+h*d;a<0?a=0:a>2&&(a=2);for(let n=0;n<f;n++){const u=l?.[n]??l?.[0];e[n][t]=(u?u[t]:0)*a}}return!0}}registerProcessor("vca",v);})();\n';
|
|
60
69
|
|
|
70
|
+
// src/lib-runtime/generated/worklet-src/vinyl-noise.ts
|
|
71
|
+
var vinyl_noise_default = '(()=>{var u=Object.defineProperty;var b=(r,i,t)=>i in r?u(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var s=(r,i,t)=>b(r,typeof i!="symbol"?i+"":i,t);class k extends AudioWorkletProcessor{constructor(t){super();s(this,"a");s(this,"b0",0);s(this,"b1",0);s(this,"b2",0);s(this,"untilClick");s(this,"clickEnv",0);s(this,"clickDecay",0);this.a=(t?.processorOptions?.seed??668265263)>>>0,this.untilClick=this.nextGap()}rand(){this.a=this.a+1831565813|0;let t=Math.imul(this.a^this.a>>>15,1|this.a);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}nextGap(){return Math.max(1,Math.round(-Math.log(1-this.rand())/7*sampleRate))}process(t,c){const a=c[0]?.[0];if(!a)return!0;const o=.006/.429;for(let e=0;e<a.length;e++){const n=this.rand()*2-1;this.b0=.99765*this.b0+n*.099046,this.b1=.963*this.b1+n*.2965164,this.b2=.57*this.b2+n*1.0526913;let l=(this.b0+this.b1+this.b2+n*.1848)*.25*o;if(--this.untilClick<=0){const h=this.rand();this.clickEnv=.2*h*h*h;const p=(8e-5+this.rand()*42e-5)*sampleRate;this.clickDecay=Math.exp(-1/p),this.untilClick=this.nextGap()}this.clickEnv>1e-6&&(l+=this.clickEnv*n,this.clickEnv*=this.clickDecay),a[e]=l}for(let e=1;e<c[0].length;e++)c[0][e].set(a);return!0}}registerProcessor("vinyl-noise",k);})();\n';
|
|
72
|
+
|
|
61
73
|
// src/lib-runtime/generated/worklet-src/waveshaper.ts
|
|
62
74
|
var waveshaper_default = '(()=>{var J=Object.defineProperty;var X=(g,w,t)=>w in g?J(g,w,{enumerable:!0,configurable:!0,writable:!0,value:t}):g[w]=t;var r=(g,w,t)=>X(g,typeof w!="symbol"?w+"":w,t);const F=new Float32Array([.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.142,.333,.556,.731,.827,.873,.903,.188,.387,.59,.74,.821,.857,.882,.207,.422,.622,.756,.824,.855,.872,.217,.442,.642,.767,.827,.851,.868,.222,.452,.653,.774,.828,.852,.865,.224,.455,.657,.776,.829,.85,.862,.222,.452,.653,.774,.828,.852,.865,.217,.442,.642,.767,.827,.851,.868,.207,.422,.622,.756,.824,.855,.872,.187,.387,.59,.74,.821,.857,.882,.142,.333,.556,.731,.827,.873,.903,.152,.36,.61,.816,.935,.994,1.034,.27,.488,.689,.838,.924,.965,.994,.352,.592,.765,.874,.931,.958,.975,.401,.661,.819,.901,.939,.954,.966,.428,.7,.85,.917,.943,.954,.96,.437,.712,.861,.922,.945,.953,.957,.428,.7,.85,.917,.943,.954,.96,.401,.661,.819,.901,.939,.954,.966,.352,.592,.765,.874,.931,.958,.975,.27,.488,.689,.838,.924,.964,.995,.152,.36,.61,.816,.935,.994,1.034,.154,.369,.638,.876,1.028,1.108,1.165,.333,.551,.752,.912,1.012,1.063,1.103,.502,.721,.867,.967,1.025,1.053,1.074,.636,.849,.953,1.008,1.037,1.05,1.06,.724,.929,1.004,1.033,1.045,1.05,1.053,.754,.956,1.021,1.042,1.048,1.05,1.049,.724,.929,1.004,1.033,1.045,1.05,1.053,.636,.849,.953,1.008,1.037,1.05,1.06,.502,.721,.867,.967,1.025,1.053,1.073,.333,.551,.752,.912,1.012,1.063,1.103,.154,.369,.638,.876,1.028,1.108,1.165,.154,.372,.655,.923,1.11,1.216,1.296,.367,.586,.793,.969,1.09,1.154,1.208,.582,.79,.933,1.039,1.108,1.142,1.169,.77,.947,1.037,1.092,1.125,1.14,1.151,.901,1.047,1.1,1.124,1.135,1.14,1.144,.948,1.082,1.122,1.135,1.139,1.14,1.138,.901,1.047,1.1,1.124,1.135,1.14,1.144,.77,.947,1.037,1.092,1.125,1.14,1.151,.582,.79,.933,1.039,1.108,1.142,1.169,.367,.586,.793,.969,1.09,1.154,1.208,.154,.372,.655,.923,1.11,1.216,1.296,.154,.374,.668,.962,1.185,1.32,1.427,.377,.604,.821,1.016,1.159,1.24,1.31,.585,.811,.973,1.097,1.183,1.226,1.261,.753,.965,1.083,1.157,1.203,1.224,1.24,.862,1.061,1.15,1.194,1.216,1.225,1.232,.899,1.094,1.172,1.207,1.22,1.225,1.224,.862,1.061,1.15,1.194,1.216,1.225,1.232,.753,.965,1.083,1.157,1.203,1.224,1.24,.585,.811,.973,1.097,1.183,1.226,1.261,.377,.604,.821,1.016,1.159,1.24,1.31,.154,.374,.668,.962,1.185,1.32,1.427,.154,.372,.657,.934,1.137,1.257,1.35,.373,.594,.802,.985,1.116,1.188,1.249,.592,.801,.948,1.06,1.137,1.175,1.206,.781,.96,1.056,1.117,1.155,1.173,1.186,.911,1.06,1.121,1.152,1.167,1.173,1.178,.957,1.095,1.143,1.163,1.171,1.173,1.172,.911,1.06,1.121,1.152,1.167,1.173,1.178,.781,.96,1.056,1.117,1.155,1.173,1.186,.592,.801,.948,1.06,1.137,1.175,1.206,.373,.594,.802,.985,1.116,1.188,1.249,.154,.372,.657,.934,1.137,1.257,1.35,.154,.37,.647,.907,1.093,1.199,1.28,.367,.582,.784,.955,1.074,1.14,1.194,.592,.786,.922,1.025,1.093,1.128,1.155,.798,.946,1.026,1.077,1.11,1.125,1.137,.947,1.049,1.089,1.11,1.121,1.125,1.129,1.003,1.085,1.11,1.121,1.124,1.125,1.124,.947,1.049,1.089,1.11,1.121,1.125,1.129,.798,.946,1.026,1.077,1.11,1.125,1.137,.592,.786,.922,1.025,1.093,1.128,1.155,.367,.582,.784,.955,1.074,1.14,1.194,.154,.37,.647,.907,1.093,1.199,1.28,.153,.367,.636,.882,1.051,1.146,1.217,.358,.569,.764,.926,1.035,1.094,1.142,.583,.767,.896,.99,1.052,1.083,1.107,.799,.925,.994,1.039,1.067,1.081,1.091,.964,1.028,1.055,1.069,1.077,1.081,1.083,1.028,1.064,1.075,1.079,1.08,1.081,1.08,.964,1.028,1.055,1.069,1.077,1.081,1.084,.799,.925,.994,1.039,1.067,1.081,1.091,.583,.767,.896,.99,1.052,1.083,1.107,.358,.569,.764,.926,1.035,1.095,1.142,.153,.367,.636,.882,1.051,1.146,1.217,.153,.365,.625,.857,1.011,1.096,1.16,.348,.556,.745,.898,.999,1.052,1.095,.567,.746,.868,.957,1.014,1.042,1.064,.785,.899,.961,1.002,1.027,1.039,1.048,.958,1,1.018,1.029,1.036,1.039,1.041,1.027,1.035,1.038,1.039,1.039,1.039,1.038,.958,1,1.018,1.029,1.036,1.039,1.041,.785,.899,.961,1.002,1.027,1.039,1.048,.567,.746,.868,.957,1.014,1.042,1.064,.348,.556,.745,.898,.999,1.052,1.095,.153,.365,.625,.857,1.011,1.096,1.16,.153,.362,.615,.833,.975,1.051,1.107,.336,.541,.726,.871,.964,1.013,1.051,.546,.722,.841,.925,.977,1.003,1.023,.758,.869,.928,.966,.989,1.001,1.009,.931,.966,.982,.991,.997,1,1.002,1,1,1,1,1,1,1,.931,.966,.982,.991,.997,1,1.002,.758,.869,.928,.966,.989,1.001,1.009,.546,.722,.841,.925,.977,1.003,1.023,.336,.541,.726,.871,.964,1.013,1.051,.153,.362,.615,.833,.975,1.051,1.107]),K=11,D=11,T=7;const N=[5.7814,6.7814,7.7814,8.7814,9.7814,10.7814,11.7814],e=class e extends AudioWorkletProcessor{constructor(){super(...arguments);r(this,"phase",0);r(this,"normGain",1);r(this,"normTarget",1);r(this,"osW1",0);r(this,"osW2",0);r(this,"stepPos",new Float64Array(3));r(this,"stepAmp",new Float64Array(3));r(this,"nSteps",0)}static get parameterDescriptors(){return[{name:"skew",defaultValue:0,minValue:-34e37,maxValue:34e37,automationRate:"a-rate"},{name:"shape",defaultValue:0,minValue:-34e37,maxValue:34e37,automationRate:"a-rate"},{name:"normalize",defaultValue:0,minValue:0,maxValue:1,automationRate:"k-rate"}]}static awBilinear(t,o,n,a,i,s){const h=(y,c)=>(y*D+c)*T+i,u=h(t,n),A=h(t+1,n),S=h(t,n+1),E=h(t+1,n+1),f=F[u]*(1-s)+F[u+1]*s,b=F[A]*(1-s)+F[A+1]*s,m=F[S]*(1-s)+F[S+1]*s,d=F[E]*(1-s)+F[E+1]*s,l=f*(1-a)+m*a,p=b*(1-a)+d*a;return l*(1-o)+p*o}static awGainLookup(t,o,n){const a=Math.min(Math.max(t,0),1)*(K-1),i=Math.min(Math.max(o,0),1)*(D-1),h=(Math.log2(Math.max(n,20))-N[0])/(N[T-1]-N[0]),u=Math.min(Math.max(h*(T-1),0),T-1),A=Math.min(Math.floor(a),K-2),S=a-A,E=Math.min(Math.floor(i),D-2),f=i-E,b=Math.min(Math.floor(u),T-2),m=u-b,d=e.awBilinear(A,S,E,f,b,m),l=e.awBilinear(A,S,E,f,e.AW_REF_FI,0);return l<=1e-6?d:l*Math.pow(d/l,e.AW_TILT)}static shapeMap(t,o,n,a){let i;if(o<=.5){const s=Math.abs(t);i=(t>=0?1:-1)*Math.pow(s,n)}else{const s=(o-.5)*2,h=Math.sin(t*Math.PI*.5);i=t+(h-t)*s}return a>0&&(i=(1-a)*i+a*(t>=0?1:-1)),i}static blep(t){if(t>=0){if(t>=1)return 0;const n=t-1;return-.5*n*n}if(t<=-1)return 0;const o=t+1;return .5*o*o}static eval(t,o,n){const a=Math.min(Math.max(o,.001),.999);let i;t<a?i=t/a:i=1-(t-a)/(1-a);const s=2*i-1;if(n<=.5){const h=Math.max(n*2,.05),u=Math.abs(s);return(s>=0?1:-1)*Math.pow(u,h)}else{const h=(n-.5)*2,u=Math.sin(s*Math.PI*.5);return s+(u-s)*h}}cornerSample(t,o,n,a,i,s,h,u){let A;t<o?A=t/o:A=1-(t-o)/(1-o);let S=2*A-1;n>0&&(S=(1-n)*S+n*(a?2*t-1:1-2*t));let E=e.shapeMap(S,i,s,h);const f=u>=0?1:-1;for(let b=0;b<this.nSteps;b++){let m=t-this.stepPos[b];m-=Math.round(m);const d=m/u;d>-1&&d<1&&(E+=f*this.stepAmp[b]*e.blep(d))}return E}process(t,o,n){const a=t[0]?.[0],i=o[0]?.[0];if(!i)return!0;const s=n.skew,h=n.shape,u=n.normalize[0]>.5,A=1/sampleRate,S=e.SMOOTH_COEFF,E=e.UPDATE_INTERVAL,f=e.SKEW_EDGE,b=e.SHAPE_EDGE;for(let m=0;m<i.length;m++){const d=a&&a.length>m?a[m]:440;let l=s.length>1?s[m]:s[0],p=h.length>1?h[m]:h[0];l=(l+1)*.5,p=(p+1)*.5,l=1-Math.abs((l%2+2)%2-1),p=1-Math.abs((p%2+2)%2-1);const y=d*A*.5;let c=0,W=!1;l<f?c=1-l/f:l>1-f&&(c=1-(1-l)/f,W=!0);let v=0,R=1;if(p<=.5){const M=p*2;R=M>b?M:b,M<b&&(v=1-M/b)}let B,I;if(v===0&&c===0)this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),B=e.eval(this.phase,l,p),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),I=e.eval(this.phase,l,p);else{const M=Math.min(Math.max(l,f),1-f),q=W?-1:1,C=W?2*M-1:1-2*M,j=W?1:-1,G=c>0?(1-c)*-1+c*q:-1,O=c>0?(1-c)*1+c*C:1,x=c>0?(1-c)*-1+c*j:-1;if(this.nSteps=0,c>0){const z=e.shapeMap(G,p,R,v)-e.shapeMap(x,p,R,v);z!==0&&(this.stepPos[this.nSteps]=0,this.stepAmp[this.nSteps++]=z)}v>0&&(G<0!=O<0&&(this.stepPos[this.nSteps]=M*(0-G)/(O-G),this.stepAmp[this.nSteps++]=O>G?2*v:-2*v),O<0!=x<0&&(this.stepPos[this.nSteps]=M+(1-M)*(0-O)/(x-O),this.stepAmp[this.nSteps++]=x>O?2*v:-2*v)),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),B=this.cornerSample(this.phase,M,c,W,p,R,v,y),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),I=this.cornerSample(this.phase,M,c,W,p,R,v,y)}const{OS_B0:P,OS_B1:Q,OS_B2:U,OS_A1:L,OS_A2:_}=e;let V=B-L*this.osW1-_*this.osW2;this.osW2=this.osW1,this.osW1=V,V=I-L*this.osW1-_*this.osW2;let H=P*V+Q*this.osW1+U*this.osW2;this.osW2=this.osW1,this.osW1=V,u&&((m&E-1)===0&&(this.normTarget=e.awGainLookup(p,l,d)),this.normGain+=S*(this.normTarget-this.normGain),H*=this.normGain),i[m]=H}return!0}};r(e,"OS_B0",.20657),r(e,"OS_B1",.41314),r(e,"OS_B2",.20657),r(e,"OS_A1",-.36953),r(e,"OS_A2",.19582),r(e,"UPDATE_INTERVAL",32),r(e,"SMOOTH_COEFF",1-Math.pow(.05,1/32)),r(e,"AW_TILT",.35),r(e,"AW_REF_FI",2),r(e,"SKEW_EDGE",.01),r(e,"SHAPE_EDGE",.05);let k=e;registerProcessor("waveshaper",k);})();\n';
|
|
63
75
|
|
|
@@ -65,12 +77,14 @@ export {
|
|
|
65
77
|
adsr_envelope_default,
|
|
66
78
|
bitcrusher_default,
|
|
67
79
|
comb_filter_default,
|
|
80
|
+
compressor_default,
|
|
68
81
|
env_follower_default,
|
|
69
82
|
fdn_reverb_default,
|
|
70
83
|
flanger_default,
|
|
71
84
|
formant_table_default,
|
|
72
85
|
freq_divider_default,
|
|
73
86
|
freq_shifter_default,
|
|
87
|
+
gate_default,
|
|
74
88
|
glide_default,
|
|
75
89
|
ladder_filter_default,
|
|
76
90
|
map_res_default,
|
|
@@ -78,10 +92,12 @@ export {
|
|
|
78
92
|
map_voct_to_period_default,
|
|
79
93
|
ping_pong_default,
|
|
80
94
|
pitch_shifter_default,
|
|
95
|
+
shaper_default,
|
|
81
96
|
spring_reverb_default,
|
|
82
97
|
tape_delay_default,
|
|
83
98
|
tape_stop_default,
|
|
84
99
|
vca_default,
|
|
100
|
+
vinyl_noise_default,
|
|
85
101
|
waveshaper_default
|
|
86
102
|
};
|
|
87
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-PJDNZ52Q.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib-runtime/generated/worklet-src/adsr-envelope.ts", "../src/lib-runtime/generated/worklet-src/bitcrusher.ts", "../src/lib-runtime/generated/worklet-src/comb-filter.ts", "../src/lib-runtime/generated/worklet-src/compressor.ts", "../src/lib-runtime/generated/worklet-src/env-follower.ts", "../src/lib-runtime/generated/worklet-src/fdn-reverb.ts", "../src/lib-runtime/generated/worklet-src/flanger.ts", "../src/lib-runtime/generated/worklet-src/formant-table.ts", "../src/lib-runtime/generated/worklet-src/freq-divider.ts", "../src/lib-runtime/generated/worklet-src/freq-shifter.ts", "../src/lib-runtime/generated/worklet-src/gate.ts", "../src/lib-runtime/generated/worklet-src/glide.ts", "../src/lib-runtime/generated/worklet-src/ladder-filter.ts", "../src/lib-runtime/generated/worklet-src/map-res.ts", "../src/lib-runtime/generated/worklet-src/map-voct-to-freq.ts", "../src/lib-runtime/generated/worklet-src/map-voct-to-period.ts", "../src/lib-runtime/generated/worklet-src/ping-pong.ts", "../src/lib-runtime/generated/worklet-src/pitch-shifter.ts", "../src/lib-runtime/generated/worklet-src/shaper.ts", "../src/lib-runtime/generated/worklet-src/spring-reverb.ts", "../src/lib-runtime/generated/worklet-src/tape-delay.ts", "../src/lib-runtime/generated/worklet-src/tape-stop.ts", "../src/lib-runtime/generated/worklet-src/vca.ts", "../src/lib-runtime/generated/worklet-src/vinyl-noise.ts", "../src/lib-runtime/generated/worklet-src/waveshaper.ts"],
|
|
4
|
+
"sourcesContent": ["export default \"(()=>{var x=Object.defineProperty;var R=(a,t,r)=>t in a?x(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r;var e=(a,t,r)=>R(a,typeof t!=\\\"symbol\\\"?t+\\\"\\\":t,r);const L=Math.log(1e3);class D extends AudioWorkletProcessor{constructor(){super(...arguments);e(this,\\\"_stage\\\",0);e(this,\\\"_level\\\",0);e(this,\\\"_prevGate\\\",0);e(this,\\\"_hold\\\",0);e(this,\\\"_prevEff\\\",!1);e(this,\\\"_dFor\\\",-1);e(this,\\\"_kd\\\",0);e(this,\\\"_rFor\\\",-1);e(this,\\\"_kr\\\",0)}static get parameterDescriptors(){return[{name:\\\"attack\\\",defaultValue:.01,minValue:.001,maxValue:2},{name:\\\"decay\\\",defaultValue:.46,minValue:.001,maxValue:10},{name:\\\"sustain\\\",defaultValue:.7,minValue:0,maxValue:1},{name:\\\"release\\\",defaultValue:2.1,minValue:.001,maxValue:20}]}process(r,V,i){const f=r[0]?.[0],n=V[0]?.[0];if(!n)return!0;const l=sampleRate,c=i.attack,_=i.decay,v=i.sustain,u=i.release;for(let s=0;s<n.length;s++){const p=f?f[s]:0,g=p>.5,F=this._prevGate>.5,k=c.length>1?c[s]:c[0],o=_.length>1?_[s]:_[0],d=v.length>1?v[s]:v[0],E=u.length>1?u[s]:u[0];g&&!F?(this._hold=Math.ceil((k+o)*l)+1,this._stage=1):this._hold>0&&this._hold--;const A=g||this._hold>0,m=this._prevEff;switch(A&&!m?this._stage=1:!A&&m&&(this._stage=4),this._stage){case 1:{const h=1/Math.max(k*l,1);this._level+=h,this._level>=1&&(this._level=1,this._stage=2);break}case 2:{o!==this._dFor&&(this._dFor=o,this._kd=Math.exp(-L/Math.max(o*l,1)));const h=(this._level-d)*this._kd;this._level=Math.abs(h)<1e-7?d:d+h;break}case 4:{E!==this._rFor&&(this._rFor=E,this._kr=Math.exp(-L/Math.max(E*l,1))),this._level*=this._kr,this._level<=1e-5&&(this._level=0,this._stage=0);break}case 0:default:this._level=0;break}this._prevGate=p,this._prevEff=A,n[s]=this._level}return!0}}registerProcessor(\\\"adsr-envelope\\\",D);})();\\n\";\n", "export default \"(()=>{var V=Object.defineProperty;var _=(e,t,r)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var l=(e,t,r)=>_(e,typeof t!=\\\"symbol\\\"?t+\\\"\\\":t,r);const d=(e,t)=>{const r=2/Math.pow(2,t);return Math.round(e/r)*r},y=(e,t)=>{if(t>=2)return d(e,t);const r=e>0?1:e<0?-1:0,a=Math.max(0,t-1);return a===0?r:r*(1-a)+d(e,2)*a};class F extends AudioWorkletProcessor{constructor(){super(...arguments);l(this,\\\"_held\\\",[0,0]);l(this,\\\"_phase\\\",0)}static get parameterDescriptors(){return[{name:\\\"bits\\\",defaultValue:8,minValue:1,maxValue:16},{name:\\\"rate\\\",defaultValue:1,minValue:.01,maxValue:1}]}process(r,a,h){const i=r[0],o=a[0];if(!o||o.length===0)return!0;const m=o.length,g=o[0].length,c=h.bits,u=h.rate,p=this._held;for(let n=0;n<g;n++){const f=c.length>1?c[n]:c[0],b=u.length>1?u[n]:u[0];if(this._phase+=b,this._phase>=1){this._phase-=1;for(let s=0;s<m;s++){const A=i?.[s]?.[n]??i?.[0]?.[n]??0;p[s]=y(A,f)}}for(let s=0;s<m;s++)o[s][n]=p[s]}return!0}}registerProcessor(\\\"bitcrusher\\\",F);})();\\n\";\n", "export default \"(()=>{var V=Object.defineProperty;var X=(a,e,r)=>e in a?V(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>X(a,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,r);class w extends AudioWorkletProcessor{constructor(r){super();o(this,\\\"len\\\");o(this,\\\"bufs\\\",[]);o(this,\\\"dcX\\\",[]);o(this,\\\"dcY\\\",[]);o(this,\\\"writeIdx\\\",0);o(this,\\\"dcR\\\",1-2*Math.PI*5/sampleRate);const f=Math.min(5,r?.processorOptions?.maxPeriod??.1);this.len=Math.ceil(f*sampleRate)+4}static get parameterDescriptors(){return[{name:\\\"period\\\",defaultValue:.005,minValue:0,maxValue:5,automationRate:\\\"a-rate\\\"},{name:\\\"feedback\\\",defaultValue:.7,minValue:0,maxValue:.95,automationRate:\\\"a-rate\\\"}]}process(r,f,_){const g=r[0]??[],i=f[0];if(!i||!i.length)return!0;const h=_.period,I=_.feedback,s=this.len,A=i[0].length,E=this.writeIdx;for(let t=0;t<i.length;t++){const u=this.bufs[t]??(this.bufs[t]=new Float32Array(s));let P=this.dcX[t]??0,b=this.dcY[t]??0;const x=g[t],F=i[t];let c=E;for(let n=0;n<A;n++){const y=h.length>1?h[n]:h[0],O=I.length>1?I[n]:I[0];let l=y*sampleRate;l<1?l=1:l>s-2&&(l=s-2);let p=c-l;p<0&&(p+=s);const d=p|0,v=p-d,C=d+1===s?0:d+1,R=u[d]+v*(u[C]-u[d]),D=R-P+this.dcR*b;P=R,b=D;let m=(x?x[n]:0)+O*D;m>-1e-20&&m<1e-20&&(m=0),u[c]=m,c=c+1===s?0:c+1,F[n]=R}this.dcX[t]=P,this.dcY[t]=b}return this.writeIdx=(E+A)%s,!0}}registerProcessor(\\\"comb-filter\\\",w);})();\\n\";\n", "export default \"(()=>{var I=Object.defineProperty;var T=(u,n,r)=>n in u?I(u,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[n]=r;var o=(u,n,r)=>T(u,typeof n!=\\\"symbol\\\"?n+\\\"\\\":n,r);const B=Math.LN10/20,S=-120,W=1e-6,j=1/30;class q extends AudioWorkletProcessor{constructor(){super();o(this,\\\"y1\\\",0);o(this,\\\"yL\\\",0);o(this,\\\"lastAtk\\\",-1);o(this,\\\"lastRel\\\",-1);o(this,\\\"aA\\\",0);o(this,\\\"aR\\\",0);o(this,\\\"meterPeriod\\\");o(this,\\\"meterCountdown\\\");o(this,\\\"meterMax\\\",0);this.meterPeriod=Math.max(1,Math.round(j*sampleRate)),this.meterCountdown=this.meterPeriod}static get parameterDescriptors(){return[{name:\\\"threshold\\\",defaultValue:-24,minValue:-60,maxValue:0,automationRate:\\\"a-rate\\\"},{name:\\\"ratio\\\",defaultValue:4,minValue:1,maxValue:20,automationRate:\\\"a-rate\\\"},{name:\\\"attack\\\",defaultValue:.003,minValue:1e-4,maxValue:1,automationRate:\\\"a-rate\\\"},{name:\\\"release\\\",defaultValue:.25,minValue:.01,maxValue:1,automationRate:\\\"a-rate\\\"},{name:\\\"knee\\\",defaultValue:10,minValue:0,maxValue:40,automationRate:\\\"a-rate\\\"},{name:\\\"makeup\\\",defaultValue:0,minValue:0,maxValue:30,automationRate:\\\"a-rate\\\"},{name:\\\"keyExt\\\",defaultValue:0,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(r,_,l){const d=r[0],h=_[0];if(!h||h.length===0)return!0;const F=h.length,O=h[0].length,V=d?d.length:0,f=l.keyExt[0]>=.5?r[1]:d,w=f?f.length:0,x=l.threshold,k=l.ratio,g=l.attack,M=l.release,y=l.knee,P=l.makeup;let s=this.yL,e=this.y1;for(let a=0;a<O;a++){const N=x.length>1?x[a]:x[0],b=k.length>1?k[a]:k[0],v=g.length>1?g[a]:g[0],A=M.length>1?M[a]:M[0],p=y.length>1?y[a]:y[0],D=P.length>1?P[a]:P[0];v!==this.lastAtk&&(this.lastAtk=v,this.aA=Math.exp(-1/(v*sampleRate))),A!==this.lastRel&&(this.lastRel=A,this.aR=Math.exp(-1/(A*sampleRate)));let c=0;for(let t=0;t<w;t++){const i=f[t][a],E=i<0?-i:i;E>c&&(c=E)}c>1e5&&(c=1e5);const R=(c>W?20*Math.log10(c):S)-N,L=1-1/b;let m=0;if(p>0&&2*Math.abs(R)<=p){const t=R+p/2;m=L*t*t/(2*p)}else R>0&&(m=L*R);const C=this.aR*e+(1-this.aR)*m;e=m>C?m:C,e<1e-9&&(e=0),s=e>s?this.aA*s+(1-this.aA)*e:e,s>this.meterMax&&(this.meterMax=s);const G=Math.exp((D-s)*B);for(let t=0;t<F;t++){const i=V===0?0:d[t<V?t:V-1][a];h[t][a]=i===i?i*G:0}--this.meterCountdown<=0&&(this.meterCountdown=this.meterPeriod,this.port.postMessage({gr:this.meterMax}),this.meterMax=0)}return this.yL=s===s&&s<1e6?s:0,this.y1=e===e&&e<1e6?e:0,!0}}registerProcessor(\\\"compressor\\\",q);})();\\n\";\n", "export default \"(()=>{var d=Object.defineProperty;var h=(t,e,a)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var u=(t,e,a)=>h(t,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,a);class V extends AudioWorkletProcessor{constructor(){super(...arguments);u(this,\\\"envelope\\\",0)}static get parameterDescriptors(){return[{name:\\\"attack\\\",defaultValue:.01,minValue:.001,maxValue:.5,automationRate:\\\"k-rate\\\"},{name:\\\"release\\\",defaultValue:.1,minValue:.001,maxValue:2,automationRate:\\\"k-rate\\\"}]}process(a,f,l){const s=a[0]?.[0],n=f[0]?.[0];if(!s||!n)return!0;const m=l.attack[0],p=l.release[0],k=Math.exp(-1/(m*sampleRate)),v=Math.exp(-1/(p*sampleRate));let o=this.envelope;for(let r=0;r<s.length;r++){const c=Math.abs(s[r]),i=c>o?k:v;o=i*o+(1-i)*c,n[r]=o}return this.envelope=o,!0}}registerProcessor(\\\"env-follower\\\",V);})();\\n\";\n", "export default \"(()=>{var a0=Object.defineProperty;var r0=(u,m,n)=>m in u?a0(u,m,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[m]=n;var a=(u,m,n)=>r0(u,typeof m!=\\\"symbol\\\"?m+\\\"\\\":m,n);const o0=[32.479167,32.645833,39.354167,37.979167,44.854167,46.729167,54.854167,54.020833,64.354167,65.020833,77.770833,76.229167,90.770833,91.854167,108.520833,108.270833],i=16,f=8,n0=[5,1.7],i0=[4.3,2.3],D=.5,J=1e-20,l0=3.3,c0=[.817561207028867,-.020162605572946,-.280270618551673,.023154427018164,-.040757497055389,.271796994004439,-.215897560174333,-.360489748784673,-.049279591845978,.496772123749905,.239792015353202,.383676880593258,-.184295710809704,.177676153912478,.520261429529717,-.458121315608967,.203489837315167,.614979612632778,.411227141461452,-.272758369017431,.436125293734819,.156096498997167,-.206758795481998,.282075316304454,.083237224745128,-.365604936961846,.479176578254122,-.175074003367075,-.395365728139379,.603943872506805,.134571883507736,.244891083396342,.212652562623983,-.476634014014298,.412616312008971,.089951269420676,.601992674099166,-.206663542542475,.311768980659393,-.216680769107754,.196676057177205,.093702545009867,-.314101445638344,-.596461670233581,-.031172939118355,-.126040534115335,.677428910755943,.14947983770607,.217781344860184,.009904403567404,-.24067985977584,.61256473635221,.150236765631027,.124750024459399,.25055095459946,.646839549112683,-.386648867952236,-.069898390896701,-.372010054619396,-.090080953220904,.481577168311424,.656722662609131,.054515042276406,-.181487450068921],h0=[-.439183217955082,-.307180489388576,-.001883582829926,-.325269531876941,.481212433268578,.473987200110376,.385696540730922,.044309574827043,-.743451734053274,-.051194577718082,-.444310999424193,-.068361324490184,-.34422386219065,-.302254563257225,-.156628949916081,.090512889617952,-.026513565311469,.086180510526682,-.240110887817448,.472502374014231,-.3649700280918,.29441974997423,.575260386278348,-.400184452422801,-.35031658889868,.550718164095976,.613748317273311,-.241201396723834,-.097299427357903,-.140520186326495,.166325223750096,-.286784761022745,.007630930996236,.146160866160651,-.025038835302295,.241738383750083,.279944636827771,-.521782099124051,.563150200067307,.501747619977534,.235033344317715,-.533857486836061,.087784021762389,-.474270156610857,-.328325006860238,-.383627102128702,.349647699653538,-.22337573142353,.209998561591045,.435210654029665,-.590338518110587,-.3973215398565,.327777471710569,-.14199393442113,.054674862535641,-.359914753494717,.177692539734562,.310687233504542,-.106824195700287,-.408479889409701,-.46224435747492,.371430762478326,.160424300333846,.562374396599422],p0=[.37,.535248,.700495,.865743],f0=[.802624,.967871,.433119,.598367],u0=[0,2,4,6],m0=[0,4,8,12],K=500,M0=.0379;function A0(u,m){const n=1-u;if(n<1e-12)return 0;const M=1-u*Math.cos(2*Math.PI*m/sampleRate);return(M-Math.sqrt(Math.max(0,M*M-n*n)))/n}function z(u,m){const n=1-u,M=2*Math.PI*m/sampleRate;return u/Math.sqrt(1-2*n*Math.cos(M)+n*n)}class d0 extends AudioWorkletProcessor{constructor(n){super();a(this,\\\"bufs\\\",[]);a(this,\\\"lens\\\",new Int32Array(i));a(this,\\\"idx\\\",new Int32Array(i));a(this,\\\"delaySec\\\",new Float64Array(i));a(this,\\\"nStages\\\",new Int32Array(i));a(this,\\\"frac\\\",new Float64Array(i));a(this,\\\"maxStages\\\",0);a(this,\\\"lp\\\",new Float64Array(0));a(this,\\\"lpF\\\",new Float64Array(i));a(this,\\\"y\\\",new Float64Array(i));a(this,\\\"sum\\\",new Float64Array(f));a(this,\\\"dif\\\",new Float64Array(f));a(this,\\\"apBuf\\\",[]);a(this,\\\"apLen\\\",[]);a(this,\\\"apIdx\\\",[0,0]);a(this,\\\"sApBuf\\\",[]);a(this,\\\"sApLen\\\",[]);a(this,\\\"sApIdx\\\",[0,0]);a(this,\\\"ceiling\\\");a(this,\\\"rc\\\",new Float64Array(f));a(this,\\\"rs\\\",new Float64Array(f));a(this,\\\"stepC\\\",new Float64Array(f));a(this,\\\"stepS\\\",new Float64Array(f));a(this,\\\"g\\\",new Float64Array(i));a(this,\\\"gTarget\\\",new Float64Array(i));a(this,\\\"lpCoef\\\",0);a(this,\\\"fracCoef\\\",new Float64Array(i));a(this,\\\"fracTarget\\\",new Float64Array(i));a(this,\\\"primed\\\",!1);const M=n?.processorOptions?.size??1;this.ceiling=n?.processorOptions?.feedbackCeiling??.995;for(let s=0;s<i;s++){const l=Math.max(2,Math.round(o0[s]/1e3*M*sampleRate));this.lens[s]=l,this.delaySec[s]=l/sampleRate,this.bufs.push(new Float32Array(l));const h=this.delaySec[s]/M0;this.nStages[s]=Math.floor(h),this.frac[s]=h-Math.floor(h),this.maxStages=Math.max(this.maxStages,this.nStages[s])}this.lp=new Float64Array(i*Math.max(1,this.maxStages));for(let s=0;s<2;s++){const l=Math.max(2,Math.round(n0[s]/1e3*sampleRate));this.apLen.push(l),this.apBuf.push(new Float32Array(l));const h=Math.max(2,Math.round(i0[s]/1e3*sampleRate));this.sApLen.push(h),this.sApBuf.push(new Float32Array(h))}for(let s=0;s<f;s++){const l=s<4?p0[s]:f0[s-4],h=s<4?u0[s]:m0[s-4];this.rc[s]=Math.cos(h),this.rs[s]=Math.sin(h);const S=2*Math.PI*l/sampleRate;this.stepC[s]=Math.cos(S),this.stepS[s]=Math.sin(S)}}static get parameterDescriptors(){return[{name:\\\"rt60\\\",defaultValue:2,minValue:.05,maxValue:30,automationRate:\\\"k-rate\\\"},{name:\\\"damping\\\",defaultValue:.55,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}updateTargets(n,M,s){const l=Math.max(n,.05),h=Math.min(2*s,.45*sampleRate),S=z(M,h)**2,A=z(M,K);for(let d=0;d<i;d++){const k=1-A0(Math.pow(S,this.frac[d]),h);this.fracTarget[d]=k;const E=Math.pow(A,this.nStages[d])*z(k,K);this.gTarget[d]=Math.min(Math.pow(10,-3*this.delaySec[d]/l)/E,this.ceiling)}}process(n,M,s){const l=M[0];if(!l||!l[0])return!0;const h=l[0],S=h.length,A=n[0],d=s.rt60[0],k=s.damping[0],E=800*Math.pow(20,Math.max(0,Math.min(1,k))),B=1-Math.exp(-2*Math.PI*E/sampleRate);this.updateTargets(d,B,E);const L=this.g,Q=this.gTarget,O=this.fracCoef,j=this.fracTarget;if(!this.primed){for(let e=0;e<i;e++)L[e]=Q[e],O[e]=j[e];this.lpCoef=B,this.primed=!0}const H=.15;for(let e=0;e<i;e++)L[e]+=(Q[e]-L[e])*H,O[e]+=(j[e]-O[e])*H;this.lpCoef+=(B-this.lpCoef)*H;const N=this.bufs,Y=this.lens,v=this.idx,$=this.lpCoef,b=this.lp,T=this.lpF,t0=this.nStages,e0=Math.max(1,this.maxStages),P=this.y,w=this.sum,x=this.dif,y=this.rc,F=this.rs,q=this.stepC,U=this.stepS,Z=l.length>1?l[1]:null,s0=!!(A&&A.length>1),G=l0*2/i;for(let e=0;e<S;e++){let R=0,V=0;A&&A.length&&(s0?(R=A[0][e],V=A[1][e]):R=V=A[0][e]);for(let t=0;t<i;t++){let o=N[t][v[t]];const r=t*e0;for(let c=0;c<t0[t];c++){const p=b[r+c]+(o-b[r+c])*$;b[r+c]=p,o=p}T[t]+=(o-T[t])*O[t],P[t]=T[t]*L[t]}let _=0,I=0;for(let t=0;t<f;t++)_+=P[2*t],I+=P[2*t+1];_*=G,I*=G;for(let t=0;t<f;t++){const o=P[2*t],r=P[2*t+1];w[t]=(o+r)*Math.SQRT1_2,x[t]=(o-r)*Math.SQRT1_2}for(let t=0;t<4;t++){const o=y[t],r=F[t],c=w[2*t],p=w[2*t+1];w[2*t]=o*c-r*p,w[2*t+1]=r*c+o*p;const C=y[t+4],g=F[t+4],X=x[2*t],W=x[2*t+1];x[2*t]=C*X-g*W,x[2*t+1]=g*X+C*W}for(let t=0;t<f;t++){const o=y[t],r=F[t];y[t]=o*q[t]-r*U[t],F[t]=r*q[t]+o*U[t]}for(let t=0;t<f;t++){let o=0,r=0;const c=t*f;for(let g=0;g<f;g++)o+=c0[c+g]*w[g],r+=h0[c+g]*x[g];const p=2*t,C=p+1;N[p][v[p]]=R+(o+r)*Math.SQRT1_2,N[C][v[C]]=V+(o-r)*Math.SQRT1_2}for(let t=0;t<i;t++)v[t]=v[t]+1===Y[t]?0:v[t]+1;for(let t=0;t<2;t++){const o=this.apBuf[t],r=this.apIdx[t],c=o[r],p=_+c*D;o[r]=p,_=c-p*D,this.apIdx[t]=r+1===this.apLen[t]?0:r+1}for(let t=0;t<2;t++){const o=this.sApBuf[t],r=this.sApIdx[t],c=o[r],p=I+c*D;o[r]=p,I=c-p*D,this.sApIdx[t]=r+1===this.sApLen[t]?0:r+1}Z?(h[e]=_,Z[e]=I):h[e]=.5*(_+I)}for(let e=0;e<f;e++){const R=1/Math.sqrt(y[e]*y[e]+F[e]*F[e]);y[e]*=R,F[e]*=R}for(let e=0;e<b.length;e++)Math.abs(b[e])<J&&(b[e]=0);for(let e=0;e<i;e++)Math.abs(T[e])<J&&(T[e]=0);for(let e=2;e<l.length;e++)l[e].set(l[e&1]);return!0}}registerProcessor(\\\"fdn-reverb\\\",d0);})();\\n\";\n", "export default \"(()=>{var D=Object.defineProperty;var P=(r,e,i)=>e in r?D(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i;var a=(r,e,i)=>P(r,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,i);const M=.009000000000000001,p=class p extends AudioWorkletProcessor{constructor(){super(...arguments);a(this,\\\"bufs\\\",[]);a(this,\\\"writeIdx\\\",0);a(this,\\\"phase\\\",0);a(this,\\\"dcX\\\",[]);a(this,\\\"dcY\\\",[]);a(this,\\\"dcR\\\",1-2*Math.PI*5/sampleRate)}static get parameterDescriptors(){return[{name:\\\"rate\\\",defaultValue:.5,minValue:.05,maxValue:10,automationRate:\\\"a-rate\\\"},{name:\\\"depth\\\",defaultValue:.7,minValue:0,maxValue:1,automationRate:\\\"a-rate\\\"},{name:\\\"feedback\\\",defaultValue:.7,minValue:0,maxValue:.95,automationRate:\\\"a-rate\\\"}]}process(i,E,f){const x=i[0]??[],c=E[0]??[];if(!c.length)return!0;const V=c[0].length,m=f.rate,S=f.depth,A=f.feedback,n=p.LEN,R=c.length;for(;this.bufs.length<R;)this.bufs.push(new Float32Array(n)),this.dcX.push(0),this.dcY.push(0);for(let s=0;s<V;s++){const _=m.length>1?m[s]:m[0],w=S.length>1?S[s]:S[0],Y=A.length>1?A[s]:A[0];let h=(.005+w*.004*Math.sin(2*Math.PI*this.phase))*sampleRate;h<1?h=1:h>n-2&&(h=n-2);let l=this.writeIdx-h;l<0&&(l+=n);const o=l|0,v=l-o,L=o+1===n?0:o+1;for(let t=0;t<R;t++){const d=this.bufs[t],g=x[t]??x[0],b=d[o]+v*(d[L]-d[o]),y=b-this.dcX[t]+this.dcR*this.dcY[t];this.dcX[t]=b,this.dcY[t]=y;let u=(g?g[s]:0)+Y*y;u>-1e-20&&u<1e-20&&(u=0),d[this.writeIdx]=u,c[t][s]=b}this.writeIdx=this.writeIdx+1===n?0:this.writeIdx+1,this.phase+=_/sampleRate,this.phase>=1&&(this.phase-=1)}return!0}};a(p,\\\"LEN\\\",Math.ceil(M*sampleRate)+8);let I=p;registerProcessor(\\\"flanger\\\",I);})();\\n\";\n", "export default \"(()=>{const M=[[800,1200,2500,3300,3750],[400,2e3,2800,3500,4500],[300,2300,3e3,3500,4500],[500,900,2500,3300,3750],[350,700,2500,3300,3750]],A=[[80,90,120,130,140],[60,80,120,150,200],[50,100,120,150,200],[70,80,100,130,135],[50,60,170,180,200]],a=6,W=5.2;class x extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:\\\"baseMorph\\\",defaultValue:0,automationRate:\\\"k-rate\\\"},{name:\\\"resonance\\\",defaultValue:a,minValue:1,maxValue:20,automationRate:\\\"k-rate\\\"}]}process(d,g,c){const l=d[0],o=g[0],u=l.length>0?l[0]:null,R=c.baseMorph[0],i=Math.min(20,Math.max(1,c.resonance[0])),V=a/i,k=W*Math.sqrt(i/a),e=o.length;if(!o[0])return!0;const E=o[0].length;for(let n=0;n<E;n++){const F=u?u[n]:0,r=((R+F)%5+5)%5,s=Math.floor(r)%5,f=(s+1)%5,h=r-Math.floor(r),m=M[s],L=M[f],p=A[s],w=A[f];for(let t=0;t<5;t++){const b=m[t]+(L[t]-m[t])*h,P=(p[t]+(w[t]-p[t])*h)*V;t<e&&(o[t][n]=b),t+5<e&&(o[t+5][n]=b/P)}e>10&&(o[10][n]=k)}return!0}}registerProcessor(\\\"formant-table\\\",x);})();\\n\";\n", "export default \"(()=>{var F=Object.defineProperty;var b=(a,e,i)=>e in a?F(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i;var t=(a,e,i)=>b(a,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,i);class w extends AudioWorkletProcessor{constructor(){super(...arguments);t(this,\\\"prevSample\\\",0);t(this,\\\"div1State\\\",!1);t(this,\\\"div2Count\\\",0);t(this,\\\"div2State\\\",!1);t(this,\\\"envelope\\\",0);t(this,\\\"smoothGate\\\",0);t(this,\\\"samplesSinceCross\\\",0);t(this,\\\"freqEstimate\\\",0)}static get parameterDescriptors(){return[{name:\\\"oct1Level\\\",defaultValue:.5,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"},{name:\\\"oct2Level\\\",defaultValue:.3,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(i,o,h){const r=i[0]?.[0],v=o[0]?.[0],p=o[1],m=o[2]?.[0];if(!r)return!0;const g=h.oct1Level[0],q=h.oct2Level[0],G=.01,V=.01,R=5e-4,A=.02,E=.002,f=p?.[0],u=p?.[1];for(let s=0;s<r.length;s++){const n=r[s],l=Math.abs(n);if(l>this.envelope?this.envelope+=V*(l-this.envelope):this.envelope+=R*(l-this.envelope),this.samplesSinceCross++,this.prevSample<=0&&n>0){if(this.div1State=!this.div1State,this.div2Count++,this.div2Count>=2&&(this.div2State=!this.div2State,this.div2Count=0),this.samplesSinceCross>4&&this.samplesSinceCross<sampleRate){const k=sampleRate/this.samplesSinceCross;this.freqEstimate+=.05*(k-this.freqEstimate)}this.samplesSinceCross=0}this.prevSample=n;const d=this.envelope>G?1:0,L=d>this.smoothGate?A:E;this.smoothGate+=L*(d-this.smoothGate);const S=this.div1State?1:-1,C=this.div2State?1:-1,c=this.smoothGate*this.envelope;v&&(v[s]=(S*g+C*q)*c),f&&(f[s]=S*c),u&&(u[s]=C*c),m&&(m[s]=this.freqEstimate*this.smoothGate)}return!0}}registerProcessor(\\\"freq-divider\\\",w);})();\\n\";\n", "export default \"(()=>{var q=Object.defineProperty;var B=(r,t,s)=>t in r?q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>B(r,typeof t!=\\\"symbol\\\"?t+\\\"\\\":t,s);const C=[.6923877778065,.9360654322959,.988229522686,.9987488452737],S=[.4021921162426,.856171088242,.9722909545651,.9952884791278];class m{constructor(t){e(this,\\\"a2\\\");e(this,\\\"x1\\\",0);e(this,\\\"x2\\\",0);e(this,\\\"y1\\\",0);e(this,\\\"y2\\\",0);this.a2=t}process(t){const s=this.a2*(t+this.y2)-this.x2;return this.x2=this.x1,this.x1=t,this.y2=this.y1,this.y1=s,s}}class w extends AudioWorkletProcessor{constructor(){super(...arguments);e(this,\\\"branchA\\\",C.map(s=>new m(s)));e(this,\\\"branchB\\\",S.map(s=>new m(s)));e(this,\\\"delayA\\\",0);e(this,\\\"phase\\\",0)}static get parameterDescriptors(){return[{name:\\\"shift\\\",defaultValue:0,minValue:-8e3,maxValue:8e3,automationRate:\\\"a-rate\\\"}]}process(s,y,A){const u=s[0]?.[0],n=y[0]?.[0];if(!n)return!0;if(!u)return n.fill(0),!0;const o=A.shift,c=2*Math.PI,b=c/sampleRate;for(let i=0;i<n.length;i++){const h=o.length>1?o[i]:o[0],v=h<0?-1:1,g=h<0?-h:h,f=u[i];let p=f;for(let a=0;a<this.branchA.length;a++)p=this.branchA[a].process(p);let l=f;for(let a=0;a<this.branchB.length;a++)l=this.branchB[a].process(l);const x=this.delayA,F=l;this.delayA=p,this.phase+=b*g,this.phase>=c&&(this.phase-=c);const d=Math.cos(this.phase),P=Math.sin(this.phase);n[i]=x*d+v*F*P}return!0}}registerProcessor(\\\"freq-shifter\\\",w);})();\\n\";\n", "export default \"(()=>{var F=Object.defineProperty;var I=(o,e,a)=>e in o?F(o,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[e]=a;var h=(o,e,a)=>I(o,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,a);class P extends AudioWorkletProcessor{constructor(){super(...arguments);h(this,\\\"detectorEnv\\\",0);h(this,\\\"gain\\\",0);h(this,\\\"isOpen\\\",!1)}static get parameterDescriptors(){return[{name:\\\"threshold\\\",defaultValue:-40,minValue:-60,maxValue:0,automationRate:\\\"k-rate\\\"},{name:\\\"range\\\",defaultValue:.8,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"},{name:\\\"attack\\\",defaultValue:.005,minValue:.001,maxValue:.05,automationRate:\\\"k-rate\\\"},{name:\\\"release\\\",defaultValue:.1,minValue:.01,maxValue:.5,automationRate:\\\"k-rate\\\"},{name:\\\"keyExt\\\",defaultValue:0,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(a,k,s){const f=a[0],l=k[0];if(!l||l.length===0)return!0;const m=f?f.length:0,x=l.length,d=s.keyExt[0]>=.5?a[1]:f,T=d?d.length:0,C=l[0].length,V=s.threshold[0],v=s.range[0],A=s.attack[0],M=s.release[0],S=Math.pow(10,V/20),y=Math.pow(10,(V-2)/20),D=1-v,p=Math.exp(-1/(.001*sampleRate)),O=Math.exp(-1/(A*sampleRate)),_=Math.exp(-1/(M*sampleRate));let r=this.detectorEnv,c=this.gain,i=this.isOpen;for(let u=0;u<C;u++){let g=0;for(let t=0;t<T;t++){const n=Math.abs(d[t][u]);n>g&&(g=n)}r=p*r+(1-p)*g,i?r<y&&(i=!1):r>S&&(i=!0);const E=i?1:D,R=E>c?O:_;c=R*c+(1-R)*E;for(let t=0;t<x;t++){const n=m===0?0:f[t<m?t:m-1][u];l[t][u]=n===n?n*c:0}}return this.detectorEnv=r,this.gain=c,this.isOpen=i,!0}}registerProcessor(\\\"gate\\\",P);})();\\n\";\n", "export default \"(()=>{var m=Object.defineProperty;var v=(r,t,e)=>t in r?m(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>v(r,typeof t!=\\\"symbol\\\"?t+\\\"\\\":t,e);class f extends AudioWorkletProcessor{constructor(){super(...arguments);s(this,\\\"y\\\",0);s(this,\\\"initialized\\\",!1);s(this,\\\"prevGate\\\",-1)}static get parameterDescriptors(){return[{name:\\\"time\\\",defaultValue:.1}]}process(e,p,u){const n=e[0]?.[0],l=e[1]?.[0],a=p[0]?.[0];if(!n||!a)return!0;const o=u.time;for(let i=0;i<a.length;i++){const c=n[i],d=o.length>1?o[i]:o[0],h=l?l[i]:-1,g=1-Math.exp(-3/(sampleRate*Math.max(d,1e-4))),y=h>0&&this.prevGate<=0;!this.initialized||y?(this.y=c,this.initialized=!0):this.y+=g*(c-this.y),this.prevGate=h,a[i]=this.y}return!0}}registerProcessor(\\\"glide\\\",f);})();\\n\";\n", "export default \"(()=>{var k=Object.defineProperty;var C=(a,e,n)=>e in a?k(a,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[e]=n;var y=(a,e,n)=>C(a,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,n);const V=Math.PI*2,W=()=>({y1:0,y2:0,y3:0,y4:0,dcIn:0,dcOut:0});class w extends AudioWorkletProcessor{constructor(){super(...arguments);y(this,\\\"states\\\",[]);y(this,\\\"noisePhase\\\",1)}static get parameterDescriptors(){return[{name:\\\"cutoff\\\",defaultValue:0,minValue:0,maxValue:24e3,automationRate:\\\"a-rate\\\"},{name:\\\"resonance\\\",defaultValue:.6,minValue:-2,maxValue:2,automationRate:\\\"a-rate\\\"},{name:\\\"drive\\\",defaultValue:.3,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(n,M,f){const d=n[0]??[],c=M[0];if(!c||c.length===0)return!0;const i=f.cutoff,l=f.resonance,b=1+f.drive[0]*3,I=sampleRate*2,v=1-V*5/sampleRate,m=sampleRate*.45;for(let s=0;s<c.length;s++){const p=c[s],g=d[s]??d[0],t=this.states[s]??(this.states[s]=W());for(let o=0;o<p.length;o++){const O=g?g[o]:0,h=i.length>1?i[o]:i[0],A=h<8?8:h>m?m:h;let r=l.length>1?l[o]:l[0];r<0?r=0:r>1.15&&(r=1.15);const F=r*4,u=1-Math.exp(-V*A/I);this.noisePhase=this.noisePhase*1103515245+12345&2147483647;const L=(this.noisePhase/2147483647-.5)*2e-7;for(let R=0;R<2;R++){const S=Math.tanh(b*O-F*t.y4+L);t.y1+=u*(S-t.y1),t.y2+=u*(Math.tanh(t.y1)-t.y2),t.y3+=u*(Math.tanh(t.y2)-t.y3),t.y4+=u*(Math.tanh(t.y3)-t.y4)}const x=t.y4*(1+r),P=x-t.dcIn+v*t.dcOut;t.dcIn=x,t.dcOut=P,p[o]=P}Math.abs(t.y4)<1e-20&&(t.y1=t.y2=t.y3=t.y4=0)}return!0}}registerProcessor(\\\"ladder-filter\\\",w);})();\\n\";\n", "export default \"(()=>{class x extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:\\\"base\\\",defaultValue:1,minValue:.001,maxValue:1e3},{name:\\\"cvScale\\\",defaultValue:19.9,minValue:0,maxValue:1e3},{name:\\\"qMin\\\",defaultValue:.1,minValue:.001,maxValue:1e3},{name:\\\"qMax\\\",defaultValue:20,minValue:.001,maxValue:1e3},{name:\\\"dbOut\\\",defaultValue:1,minValue:0,maxValue:1}]}process(r,i,t){const s=r[0]?.[0],l=i[0]?.[0];if(!l)return!0;const n=t.base,u=t.cvScale,o=t.qMin[0],c=t.qMax[0],V=t.dbOut[0]>=.5;for(let e=0;e<l.length;e++){const m=n.length>1?n[e]:n[0],d=u.length>1?u[e]:u[0],f=s?s[e]:0;let a=m+f*d;a<o?a=o:a>c&&(a=c),l[e]=V?20*Math.log10(a):a}return!0}}registerProcessor(\\\"map-res\\\",x);})();\\n\";\n", "export default \"(()=>{class u extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:\\\"transpose\\\",defaultValue:0}]}process(s,a,n){const o=s[0]?.[0],r=a[0]?.[0];if(!r)return!0;const e=n.transpose;for(let t=0;t<r.length;t++){const c=e.length>1?e[t]:e[0],p=(o?o[t]:0)+c;r[t]=440*Math.pow(2,(p-69)/12)}return!0}}registerProcessor(\\\"map-voct-to-freq\\\",u);})();\\n\";\n", "export default \"(()=>{class i extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:\\\"transpose\\\",defaultValue:0}]}process(s,a,n){const e=s[0]?.[0],r=a[0]?.[0];if(!r)return!0;const o=n.transpose;for(let t=0;t<r.length;t++){const c=o.length>1?o[t]:o[0],p=(e?e[t]:0)+c,u=440*Math.pow(2,(p-69)/12);r[t]=1/u}return!0}}registerProcessor(\\\"map-voct-to-period\\\",i);})();\\n\";\n", "export default \"(()=>{var I=Object.defineProperty;var k=(s,e,n)=>e in s?I(s,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[e]=n;var r=(s,e,n)=>k(s,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,n);class x extends AudioWorkletProcessor{constructor(){super(...arguments);r(this,\\\"bufL\\\",new Float32Array(Math.ceil(2*sampleRate)+4));r(this,\\\"bufR\\\",new Float32Array(Math.ceil(2*2*sampleRate)+4));r(this,\\\"wL\\\",0);r(this,\\\"wR\\\",0);r(this,\\\"dcX\\\",0);r(this,\\\"dcY\\\",0);r(this,\\\"dcR\\\",1-2*Math.PI*5/sampleRate)}static get parameterDescriptors(){return[{name:\\\"time\\\",defaultValue:.3,minValue:.01,maxValue:2,automationRate:\\\"k-rate\\\"},{name:\\\"feedback\\\",defaultValue:.4,minValue:0,maxValue:.95,automationRate:\\\"a-rate\\\"}]}process(n,L,P){const X=n[0]?.[0],b=L[0]?.[0],_=L[1]?.[0];if(!b||!_)return!0;const v=P.time,M=P.feedback,g=this.bufL,A=this.bufR,f=g.length,R=A.length,F=this.dcR;let l=v[0]*sampleRate;l<1?l=1:l>f-3&&(l=f-3);let u=2*v[0]*sampleRate;u<1?u=1:u>R-3&&(u=R-3);let i=this.wL,o=this.wR,w=this.dcX,c=this.dcY;const y=(t,m,h,p)=>{let a=h-p;a<0&&(a+=m);const d=a|0,T=a-d,V=d+1===m?0:d+1;return t[d]+(t[V]-t[d])*T};for(let t=0;t<b.length;t++){const m=X?X[t]:0,h=M.length>1?M[t]:M[0],p=y(g,f,i,l),a=y(A,R,o,u);c=a-w+F*c,w=a,g[i]=m+h*c,A[o]=h*p,b[t]=p,_[t]=a,i++,i===f&&(i=0),o++,o===R&&(o=0)}return Math.abs(c)<1e-20&&(c=0),this.wL=i,this.wR=o,this.dcX=w,this.dcY=c,!0}}registerProcessor(\\\"ping-pong\\\",x);})();\\n\";\n", "export default \"(()=>{var R=Object.defineProperty;var y=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>y(i,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,t);class E extends AudioWorkletProcessor{constructor(t){super();r(this,\\\"ring\\\");r(this,\\\"ringLen\\\");r(this,\\\"writePos\\\",0);r(this,\\\"readPos\\\");r(this,\\\"grainPhase\\\");r(this,\\\"grainLen\\\");r(this,\\\"jitterLen\\\");r(this,\\\"rng\\\");this.rng=(t?.processorOptions?.seed??2654435769)>>>0||1,this.jitterLen=Math.round(sampleRate*.01),this.ringLen=Math.ceil(sampleRate*1),this.ring=new Float32Array(this.ringLen),this.grainLen=Math.floor(sampleRate*.08),this.readPos=new Float64Array([0,0]),this.grainPhase=new Float64Array([0,.5]),this.readPos[0]=this.readPos[1]=this.ringLen-this.grainLen}static get parameterDescriptors(){return[{name:\\\"semitones\\\",defaultValue:12,minValue:-24,maxValue:24,automationRate:\\\"k-rate\\\"}]}rand(){let t=this.rng;return t^=t<<13,t^=t>>>17,t^=t<<5,this.rng=t>>>0,this.rng/4294967296}process(t,P,p){const h=t[0]?.[0],o=P[0]?.[0];if(!o)return!0;const d=p.semitones[0],c=Math.pow(2,d/12),u=1/this.grainLen,L=2*Math.PI;for(let n=0;n<o.length;n++){const m=h?h[n]:0;this.ring[this.writePos]=m;let g=0;for(let s=0;s<2;s++){if(this.grainPhase[s]+=u,this.grainPhase[s]>=1){this.grainPhase[s]-=1;const f=Math.max(0,c-1)*this.grainLen+2+this.rand()*this.jitterLen;this.readPos[s]=(this.writePos-f+this.ringLen)%this.ringLen}else this.readPos[s]+=c,this.readPos[s]>=this.ringLen?this.readPos[s]-=this.ringLen:this.readPos[s]<0&&(this.readPos[s]+=this.ringLen);const l=this.readPos[s],a=l|0,A=l-a,S=(a+1)%this.ringLen,w=this.ring[a]+A*(this.ring[S]-this.ring[a]),N=.5-.5*Math.cos(L*this.grainPhase[s]);g+=w*N}o[n]=g,this.writePos=this.writePos+1===this.ringLen?0:this.writePos+1}return!0}}registerProcessor(\\\"pitch-shifter\\\",E);})();\\n\";\n", "export default \"(()=>{var b=Object.defineProperty;var g=(l,h,r)=>h in l?b(l,h,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[h]=r;var i=(l,h,r)=>g(l,typeof h!=\\\"symbol\\\"?h+\\\"\\\":h,r);const F=[.02715585672648318,.10300238556004077,.21303004592041422,.33933626891036295,.46602752012040527,.5822470138570043,.6825907648523519,.7659552823868774,.8339692410251047,.8896926536875072,.9368031111658155,.9792387297342222],A=[],p=[];for(let l=0;l<F.length;l++)(l%2===0?A:p).push(F[l]);const d=A.length,f=p.length;function y(l,h,r,t){for(let e=0;e<h;e++){const n=e*2,s=l[e]*(t-r[n+1])+r[n];r[n]=t,r[n+1]=s,t=s}return t}class m{constructor(){i(this,\\\"upA\\\",new Float64Array(d*2));i(this,\\\"upB\\\",new Float64Array(f*2));i(this,\\\"dnA\\\",new Float64Array(d*2));i(this,\\\"dnB\\\",new Float64Array(f*2));i(this,\\\"dUpA\\\",new Float64Array(d*2));i(this,\\\"dUpB\\\",new Float64Array(f*2));i(this,\\\"dDnA\\\",new Float64Array(d*2));i(this,\\\"dDnB\\\",new Float64Array(f*2));i(this,\\\"u1\\\",0);i(this,\\\"F1\\\",0);i(this,\\\"d1\\\",0)}}class w extends AudioWorkletProcessor{constructor(r){super();i(this,\\\"curve\\\",new Float64Array([-1,1]));i(this,\\\"prim\\\",new Float64Array([0,0]));i(this,\\\"h\\\",2);i(this,\\\"lanes\\\",[new m,new m]);i(this,\\\"withDry\\\",!0);this.withDry=r?.processorOptions?.dry!==!1;const t=r?.processorOptions?.curve;t&&t.length>=2&&this.setCurve(t),this.port.onmessage=e=>{const n=e.data;n?.curve&&n.curve.length>=2&&this.setCurve(n.curve)}}setCurve(r){const t=r.length,e=new Float64Array(t);let n=0;for(let o=0;o<t;o++){const a=r[o];e[o]=Number.isFinite(a)?n=a:n}const s=2/(t-1),c=new Float64Array(t);for(let o=1;o<t;o++)c[o]=c[o-1]+.5*s*(e[o-1]+e[o]);this.curve=e,this.prim=c,this.h=s;for(const o of this.lanes)o.F1=this.F(o.u1)}f(r){const t=this.curve,e=t.length,n=(r+1)*.5*(e-1);if(n<=0)return t[0];if(n>=e-1)return t[e-1];const s=Math.floor(n),c=n-s;return t[s]+(t[s+1]-t[s])*c}F(r){const t=this.curve,e=this.prim,n=t.length,s=this.h,c=(r+1)*.5*(n-1);if(c<=0)return(r+1)*t[0];if(c>=n-1)return e[n-1]+(r-1)*t[n-1];const o=Math.floor(c),a=c-o;return e[o]+s*(t[o]*a+.5*(t[o+1]-t[o])*a*a)}adaa(r,t){const e=this.F(t),n=t-r.u1,s=Math.abs(n)>1e-7?(e-r.F1)/n:this.f(.5*(t+r.u1));return r.u1=t,r.F1=e,s}runWet(r,t,e){const n=e.length;for(let s=0;s<n;s++){const c=t?t[s]:0,o=y(A,d,r.upA,c),a=y(p,f,r.upB,c),u=this.adaa(r,o),v=this.adaa(r,a);e[s]=.5*(y(A,d,r.dnA,v)+y(p,f,r.dnB,u))}}runDry(r,t,e){const n=e.length;for(let s=0;s<n;s++){const c=t?t[s]:0,o=y(A,d,r.dUpA,c),a=y(p,f,r.dUpB,c),u=.5*(o+r.d1),v=.5*(a+o);r.d1=a,e[s]=.5*(y(A,d,r.dDnA,v)+y(p,f,r.dDnB,u))}}process(r,t){const e=r[0]??[],n=r[1]&&r[1].length>0?r[1]:e,s=t[0]??[],c=this.withDry?t[1]??[]:[];if(s.length===0)return!0;const o=e.length>=2?2:1;for(let a=0;a<o;a++)this.runWet(this.lanes[a],e[a],s[a]??s[0]);if(o===1)for(let a=1;a<s.length;a++)s[a].set(s[0]);if(c.length>0){const a=n.length>=2?2:1;for(let u=0;u<a;u++)this.runDry(this.lanes[u],n[u],c[u]??c[0]);if(a===1)for(let u=1;u<c.length;u++)c[u].set(c[0])}return!0}}registerProcessor(\\\"shaper\\\",w);})();\\n\";\n", "export default \"(()=>{var $=Object.defineProperty;var tt=(n,o,e)=>o in n?$(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e;var s=(n,o,e)=>tt(n,typeof o!=\\\"symbol\\\"?o+\\\"\\\":o,e);const c=[{stages:76,delayMs:37.9,chan:0},{stages:90,delayMs:41.7,chan:1},{stages:82,delayMs:51.3,chan:0},{stages:96,delayMs:47.9,chan:1}],b=c.length,st=.7,N=.95,et=2.4,at=4,nt=150,ot=15,it=.98,rt=1e-20,ct=500;function ht(n){if(n>3)return 1;if(n<-3)return-1;const o=n*n;return n*(27+o)/(27+9*o)}class pt extends AudioWorkletProcessor{constructor(){super();s(this,\\\"apX\\\",[]);s(this,\\\"apY\\\",[]);s(this,\\\"dBuf\\\",[]);s(this,\\\"dLen\\\",[]);s(this,\\\"dIdx\\\",[]);s(this,\\\"fb\\\",[]);s(this,\\\"lp\\\",[]);s(this,\\\"dc\\\",[]);s(this,\\\"g\\\",[]);s(this,\\\"inHpState\\\",0);s(this,\\\"inHpCoef\\\");s(this,\\\"dcCoef\\\");s(this,\\\"a\\\",.56);s(this,\\\"lpCoef\\\",.4);s(this,\\\"knockPos\\\",-1);s(this,\\\"knockLen\\\");s(this,\\\"prevTrig\\\",0);for(let e=0;e<b;e++){this.apX.push(new Float32Array(c[e].stages)),this.apY.push(new Float32Array(c[e].stages));const p=Math.max(2,Math.round(c[e].delayMs/1e3*sampleRate));this.dLen.push(p),this.dBuf.push(new Float32Array(p)),this.dIdx.push(0),this.fb.push(0),this.lp.push(0),this.dc.push(0),this.g.push(0)}this.inHpCoef=1-Math.exp(-2*Math.PI*nt/sampleRate),this.dcCoef=1-Math.exp(-2*Math.PI*ot/sampleRate),this.knockLen=Math.max(8,Math.round(at/1e3*sampleRate))}static get parameterDescriptors(){return[{name:\\\"decay\\\",defaultValue:1.5,minValue:.3,maxValue:4,automationRate:\\\"k-rate\\\"},{name:\\\"tone\\\",defaultValue:.6,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"},{name:\\\"drip\\\",defaultValue:.5,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(e,p,m){const h=p[0];if(!h||!h[0])return!0;const x=h[0],w=h[1]??h[0],O=x.length,M=e[0]?.[0],E=e[0]?.[1]??M,I=e[1]?.[0],B=m.decay[0],D=Math.max(0,Math.min(1,m.tone[0])),K=.35+.42*Math.max(0,Math.min(1,m.drip[0]));this.a+=(K-this.a)*.1;const i=this.a,X=1100*Math.pow(6500/1100,D),g=1-Math.exp(-2*Math.PI*X/sampleRate);this.lpCoef+=(g-this.lpCoef)*.15;const Y=this.lpCoef,L=2*Math.PI*ct/sampleRate,k=Math.cos(L),Z=(1-i*i)/(1-2*i*k+i*i),v=1-g,G=g/Math.sqrt(1-2*v*k+v*v),A=1-this.dcCoef,y=1-A*k,C=A*Math.sin(L),H=y*y+C*C,q=1-this.dcCoef*y/H,z=this.dcCoef*C/H,J=G*Math.hypot(q,z);for(let a=0;a<b;a++){const l=(this.dLen[a]+c[a].stages*Z)/sampleRate,u=Math.min(Math.pow(10,-3*l/Math.max(B,.05))/J,it);this.g[a]+=(u-this.g[a])*.15}const U=this.inHpCoef,W=this.dcCoef;for(let a=0;a<O;a++){if(I){const t=I[a];t>.5&&this.prevTrig<=.5&&(this.knockPos=0),this.prevTrig=t}const l=M?(M[a]+E[a])*.5:0;this.inHpState+=U*(l-this.inHpState);let u=(l-this.inHpState)*st;this.knockPos>=0&&(u+=Math.sin(Math.PI*this.knockPos/this.knockLen)*et,++this.knockPos>=this.knockLen&&(this.knockPos=-1));let F=0,S=0;for(let t=0;t<b;t++){let d=u+this.fb[t]+rt;const R=this.apX[t],T=this.apY[t],j=R.length;for(let r=0;r<j;r++){const V=-i*d+R[r]+i*T[r];R[r]=d,T[r]=V,d=V}const _=this.dBuf[t],f=this.dIdx[t],Q=_[f];_[f]=d,this.dIdx[t]=f+1>=this.dLen[t]?0:f+1,this.lp[t]+=Y*(Q-this.lp[t]),this.dc[t]+=W*(this.lp[t]-this.dc[t]);const P=ht(this.lp[t]-this.dc[t]);this.fb[t]=P*this.g[t],c[t].chan===0?F+=P:S+=P}x[a]=F*N,w[a]=S*N}return!0}}registerProcessor(\\\"spring-reverb\\\",pt);})();\\n\";\n", "export default \"(()=>{var L=Object.defineProperty;var Z=(s,e,t)=>e in s?L(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>Z(s,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,t);function E(s){let e=s>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}class O extends AudioWorkletProcessor{constructor(){super(...arguments);a(this,\\\"buf\\\",new Float32Array(Math.ceil(1.5*1.03*sampleRate)+4));a(this,\\\"writeIdx\\\",0);a(this,\\\"tSlew\\\",-1);a(this,\\\"slewA\\\",1-Math.exp(-1/(.08*sampleRate)));a(this,\\\"phaseWow\\\",0);a(this,\\\"phaseFlut\\\",0);a(this,\\\"wowInc\\\",2*Math.PI*.85/sampleRate);a(this,\\\"rand\\\",E(2057179700));a(this,\\\"wander\\\",0);a(this,\\\"wanderTarget\\\",0);a(this,\\\"wanderCountdown\\\",0);a(this,\\\"damp\\\",0);a(this,\\\"dampD\\\",Math.exp(-2*Math.PI*6e3/sampleRate));a(this,\\\"dcX\\\",0);a(this,\\\"dcY\\\",0);a(this,\\\"dcR\\\",1-2*Math.PI*5/sampleRate)}static get parameterDescriptors(){return[{name:\\\"time\\\",defaultValue:.375,minValue:.05,maxValue:1.5,automationRate:\\\"k-rate\\\"},{name:\\\"feedback\\\",defaultValue:.5,minValue:0,maxValue:.95,automationRate:\\\"a-rate\\\"},{name:\\\"saturation\\\",defaultValue:.4,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"},{name:\\\"flutter\\\",defaultValue:.3,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}process(t,S,u){const R=t[0]?.[0],p=S[0]?.[0];if(!p)return!0;const b=u.time,f=u.feedback,A=u.saturation,F=u.flutter,o=this.buf,l=o.length,V=this.dampD,g=this.dcR,T=b[0];this.tSlew<0&&(this.tSlew=T);const W=1+A[0]*4,x=F[0];this.wanderCountdown<=0&&(this.wanderTarget=this.rand()*2-1,this.wanderCountdown=Math.round(.5*sampleRate)),this.wanderCountdown-=p.length,this.wander+=.02*(this.wanderTarget-this.wander);const y=2*Math.PI*6.3*(1+.12*this.wander)/sampleRate;let m=this.tSlew,M=this.phaseWow,_=this.phaseFlut,n=this.damp,P=this.dcX,i=this.dcY,r=this.writeIdx;for(let h=0;h<p.length;h++){const C=R?R[h]:0,k=f.length>1?f[h]:f[0];m+=this.slewA*(T-m);let I=0;x>0&&(M+=this.wowInc,_+=y,I=x*(.008*Math.sin(M)+.0015*Math.sin(_)));let c=m*(1+I)*sampleRate;c<1?c=1:c>l-3&&(c=l-3);let w=r-c;w<0&&(w+=l);const d=w|0,D=w-d,X=d+1===l?0:d+1,H=o[d]+(o[X]-o[d])*D;n+=(1-V)*(H-n);const v=(Math.tanh(W*n)+Math.tanh(W*n*.3)*.1)/1.1;i=v-P+g*i,P=v,o[r]=C+k*i,p[h]=v,r++,r===l&&(r=0)}return Math.abs(n)<1e-20&&(n=0),Math.abs(i)<1e-20&&(i=0),this.tSlew=m,this.phaseWow=M,this.phaseFlut=_,this.damp=n,this.dcX=P,this.dcY=i,this.writeIdx=r,!0}}registerProcessor(\\\"tape-delay\\\",O);})();\\n\";\n", "export default \"(()=>{var A=Object.defineProperty;var F=(r,a,s)=>a in r?A(r,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[a]=s;var t=(r,a,s)=>F(r,typeof a!=\\\"symbol\\\"?a+\\\"\\\":a,s);const _=r=>Math.min(1,Math.max(0,r/.05));class O extends AudioWorkletProcessor{constructor(){super();t(this,\\\"bufL\\\");t(this,\\\"bufR\\\");t(this,\\\"bufLen\\\");t(this,\\\"holdLen\\\");t(this,\\\"writePos\\\",0);t(this,\\\"readPos\\\",0);t(this,\\\"speed\\\",1);t(this,\\\"ramping\\\",!1);t(this,\\\"prevTrig\\\",0);t(this,\\\"stopped\\\",!1);t(this,\\\"splice\\\",0);t(this,\\\"spliceLen\\\",1);this.bufLen=Math.ceil(sampleRate*6),this.holdLen=Math.floor(sampleRate*3.9),this.bufL=new Float32Array(this.bufLen),this.bufR=new Float32Array(this.bufLen)}static get parameterDescriptors(){return[{name:\\\"time\\\",defaultValue:.5,minValue:.005,maxValue:4},{name:\\\"mix\\\",defaultValue:1,minValue:0,maxValue:1}]}toggle(){this.stopped=!this.stopped,this.splice=0,this.ramping=!0,this.port.postMessage({type:\\\"state\\\",phase:\\\"ramping\\\"})}lag(){const s=this.writePos-this.readPos;return s<0?s+this.bufLen:s}process(s,m,L){const g=s[0]?.[0],P=s[0]?.[1],b=s[1]?.[0],f=m[0]?.[0],E=m[0]?.[1];if(!f)return!0;const M=!!E,u=L.time,d=L.mix,w=f.length;for(let i=0;i<w;i++){const x=u.length>1?u[i]:u[0],p=d.length>1?d[i]:d[0];if(b){const e=b[i];e>.5&&this.prevTrig<=.5&&this.toggle(),this.prevTrig=e}const n=g?g[i]:0,l=P?P[i]:M?n:0;if(this.ramping){const e=1/Math.max(1,x*sampleRate);this.stopped?(this.speed-=e,this.speed<=0&&(this.speed=0,this.ramping=!1,this.port.postMessage({type:\\\"state\\\",phase:\\\"stopped\\\"}))):(this.speed+=e,this.speed>=1&&(this.speed=1,this.ramping=!1,this.spliceLen=Math.max(1,Math.round(.02*sampleRate)),this.splice=this.spliceLen,this.port.postMessage({type:\\\"state\\\",phase:\\\"playing\\\"})))}const S=this.speed===0&&!this.ramping&&this.lag()>=this.holdLen;S||(this.bufL[this.writePos]=n,this.bufR[this.writePos]=l);let o=0,h=0;if(this.speed>=1&&!this.ramping&&this.splice===0)o=n,h=l,this.readPos=this.writePos;else if(this.speed>0){this.lag()>this.bufLen-4&&(this.readPos=(this.writePos+4)%this.bufLen),this.readPos=(this.readPos+this.speed)%this.bufLen;const e=Math.floor(this.readPos),v=this.readPos-e,R=(e+1)%this.bufLen;o=this.bufL[e]+v*(this.bufL[R]-this.bufL[e]),h=this.bufR[e]+v*(this.bufR[R]-this.bufR[e]);const D=_(this.speed);if(o*=D,h*=D,this.splice>0){const y=1-this.splice/this.spliceLen,c=.5-.5*Math.cos(Math.PI*y);o=o*(1-c)+n*c,h=h*(1-c)+l*c,--this.splice===0&&(this.readPos=this.writePos)}}S||(this.writePos=(this.writePos+1)%this.bufLen),f[i]=n*(1-p)+o*p,M&&(E[i]=l*(1-p)+h*p)}return!0}}registerProcessor(\\\"tape-stop\\\",O);})();\\n\";\n", "export default \"(()=>{class v extends AudioWorkletProcessor{static get parameterDescriptors(){return[{name:\\\"gain\\\",defaultValue:.5,minValue:0,maxValue:2,automationRate:\\\"a-rate\\\"},{name:\\\"cvAmount\\\",defaultValue:1,minValue:-1,maxValue:1,automationRate:\\\"a-rate\\\"},{name:\\\"cv\\\",defaultValue:0,minValue:-1e3,maxValue:1e3,automationRate:\\\"a-rate\\\"}]}process(i,m,o){const l=i[0],e=m[0];if(!e)return!0;const s=o.gain,c=o.cvAmount,r=o.cv,f=e.length,g=e[0]?.length??0;for(let t=0;t<g;t++){const V=s.length>1?s[t]:s[0],h=c.length>1?c[t]:c[0],d=r.length>1?r[t]:r[0];let a=V+h*d;a<0?a=0:a>2&&(a=2);for(let n=0;n<f;n++){const u=l?.[n]??l?.[0];e[n][t]=(u?u[t]:0)*a}}return!0}}registerProcessor(\\\"vca\\\",v);})();\\n\";\n", "export default \"(()=>{var u=Object.defineProperty;var b=(r,i,t)=>i in r?u(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var s=(r,i,t)=>b(r,typeof i!=\\\"symbol\\\"?i+\\\"\\\":i,t);class k extends AudioWorkletProcessor{constructor(t){super();s(this,\\\"a\\\");s(this,\\\"b0\\\",0);s(this,\\\"b1\\\",0);s(this,\\\"b2\\\",0);s(this,\\\"untilClick\\\");s(this,\\\"clickEnv\\\",0);s(this,\\\"clickDecay\\\",0);this.a=(t?.processorOptions?.seed??668265263)>>>0,this.untilClick=this.nextGap()}rand(){this.a=this.a+1831565813|0;let t=Math.imul(this.a^this.a>>>15,1|this.a);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}nextGap(){return Math.max(1,Math.round(-Math.log(1-this.rand())/7*sampleRate))}process(t,c){const a=c[0]?.[0];if(!a)return!0;const o=.006/.429;for(let e=0;e<a.length;e++){const n=this.rand()*2-1;this.b0=.99765*this.b0+n*.099046,this.b1=.963*this.b1+n*.2965164,this.b2=.57*this.b2+n*1.0526913;let l=(this.b0+this.b1+this.b2+n*.1848)*.25*o;if(--this.untilClick<=0){const h=this.rand();this.clickEnv=.2*h*h*h;const p=(8e-5+this.rand()*42e-5)*sampleRate;this.clickDecay=Math.exp(-1/p),this.untilClick=this.nextGap()}this.clickEnv>1e-6&&(l+=this.clickEnv*n,this.clickEnv*=this.clickDecay),a[e]=l}for(let e=1;e<c[0].length;e++)c[0][e].set(a);return!0}}registerProcessor(\\\"vinyl-noise\\\",k);})();\\n\";\n", "export default \"(()=>{var J=Object.defineProperty;var X=(g,w,t)=>w in g?J(g,w,{enumerable:!0,configurable:!0,writable:!0,value:t}):g[w]=t;var r=(g,w,t)=>X(g,typeof w!=\\\"symbol\\\"?w+\\\"\\\":w,t);const F=new Float32Array([.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.109,.263,.453,.612,.701,.744,.773,.142,.333,.556,.731,.827,.873,.903,.188,.387,.59,.74,.821,.857,.882,.207,.422,.622,.756,.824,.855,.872,.217,.442,.642,.767,.827,.851,.868,.222,.452,.653,.774,.828,.852,.865,.224,.455,.657,.776,.829,.85,.862,.222,.452,.653,.774,.828,.852,.865,.217,.442,.642,.767,.827,.851,.868,.207,.422,.622,.756,.824,.855,.872,.187,.387,.59,.74,.821,.857,.882,.142,.333,.556,.731,.827,.873,.903,.152,.36,.61,.816,.935,.994,1.034,.27,.488,.689,.838,.924,.965,.994,.352,.592,.765,.874,.931,.958,.975,.401,.661,.819,.901,.939,.954,.966,.428,.7,.85,.917,.943,.954,.96,.437,.712,.861,.922,.945,.953,.957,.428,.7,.85,.917,.943,.954,.96,.401,.661,.819,.901,.939,.954,.966,.352,.592,.765,.874,.931,.958,.975,.27,.488,.689,.838,.924,.964,.995,.152,.36,.61,.816,.935,.994,1.034,.154,.369,.638,.876,1.028,1.108,1.165,.333,.551,.752,.912,1.012,1.063,1.103,.502,.721,.867,.967,1.025,1.053,1.074,.636,.849,.953,1.008,1.037,1.05,1.06,.724,.929,1.004,1.033,1.045,1.05,1.053,.754,.956,1.021,1.042,1.048,1.05,1.049,.724,.929,1.004,1.033,1.045,1.05,1.053,.636,.849,.953,1.008,1.037,1.05,1.06,.502,.721,.867,.967,1.025,1.053,1.073,.333,.551,.752,.912,1.012,1.063,1.103,.154,.369,.638,.876,1.028,1.108,1.165,.154,.372,.655,.923,1.11,1.216,1.296,.367,.586,.793,.969,1.09,1.154,1.208,.582,.79,.933,1.039,1.108,1.142,1.169,.77,.947,1.037,1.092,1.125,1.14,1.151,.901,1.047,1.1,1.124,1.135,1.14,1.144,.948,1.082,1.122,1.135,1.139,1.14,1.138,.901,1.047,1.1,1.124,1.135,1.14,1.144,.77,.947,1.037,1.092,1.125,1.14,1.151,.582,.79,.933,1.039,1.108,1.142,1.169,.367,.586,.793,.969,1.09,1.154,1.208,.154,.372,.655,.923,1.11,1.216,1.296,.154,.374,.668,.962,1.185,1.32,1.427,.377,.604,.821,1.016,1.159,1.24,1.31,.585,.811,.973,1.097,1.183,1.226,1.261,.753,.965,1.083,1.157,1.203,1.224,1.24,.862,1.061,1.15,1.194,1.216,1.225,1.232,.899,1.094,1.172,1.207,1.22,1.225,1.224,.862,1.061,1.15,1.194,1.216,1.225,1.232,.753,.965,1.083,1.157,1.203,1.224,1.24,.585,.811,.973,1.097,1.183,1.226,1.261,.377,.604,.821,1.016,1.159,1.24,1.31,.154,.374,.668,.962,1.185,1.32,1.427,.154,.372,.657,.934,1.137,1.257,1.35,.373,.594,.802,.985,1.116,1.188,1.249,.592,.801,.948,1.06,1.137,1.175,1.206,.781,.96,1.056,1.117,1.155,1.173,1.186,.911,1.06,1.121,1.152,1.167,1.173,1.178,.957,1.095,1.143,1.163,1.171,1.173,1.172,.911,1.06,1.121,1.152,1.167,1.173,1.178,.781,.96,1.056,1.117,1.155,1.173,1.186,.592,.801,.948,1.06,1.137,1.175,1.206,.373,.594,.802,.985,1.116,1.188,1.249,.154,.372,.657,.934,1.137,1.257,1.35,.154,.37,.647,.907,1.093,1.199,1.28,.367,.582,.784,.955,1.074,1.14,1.194,.592,.786,.922,1.025,1.093,1.128,1.155,.798,.946,1.026,1.077,1.11,1.125,1.137,.947,1.049,1.089,1.11,1.121,1.125,1.129,1.003,1.085,1.11,1.121,1.124,1.125,1.124,.947,1.049,1.089,1.11,1.121,1.125,1.129,.798,.946,1.026,1.077,1.11,1.125,1.137,.592,.786,.922,1.025,1.093,1.128,1.155,.367,.582,.784,.955,1.074,1.14,1.194,.154,.37,.647,.907,1.093,1.199,1.28,.153,.367,.636,.882,1.051,1.146,1.217,.358,.569,.764,.926,1.035,1.094,1.142,.583,.767,.896,.99,1.052,1.083,1.107,.799,.925,.994,1.039,1.067,1.081,1.091,.964,1.028,1.055,1.069,1.077,1.081,1.083,1.028,1.064,1.075,1.079,1.08,1.081,1.08,.964,1.028,1.055,1.069,1.077,1.081,1.084,.799,.925,.994,1.039,1.067,1.081,1.091,.583,.767,.896,.99,1.052,1.083,1.107,.358,.569,.764,.926,1.035,1.095,1.142,.153,.367,.636,.882,1.051,1.146,1.217,.153,.365,.625,.857,1.011,1.096,1.16,.348,.556,.745,.898,.999,1.052,1.095,.567,.746,.868,.957,1.014,1.042,1.064,.785,.899,.961,1.002,1.027,1.039,1.048,.958,1,1.018,1.029,1.036,1.039,1.041,1.027,1.035,1.038,1.039,1.039,1.039,1.038,.958,1,1.018,1.029,1.036,1.039,1.041,.785,.899,.961,1.002,1.027,1.039,1.048,.567,.746,.868,.957,1.014,1.042,1.064,.348,.556,.745,.898,.999,1.052,1.095,.153,.365,.625,.857,1.011,1.096,1.16,.153,.362,.615,.833,.975,1.051,1.107,.336,.541,.726,.871,.964,1.013,1.051,.546,.722,.841,.925,.977,1.003,1.023,.758,.869,.928,.966,.989,1.001,1.009,.931,.966,.982,.991,.997,1,1.002,1,1,1,1,1,1,1,.931,.966,.982,.991,.997,1,1.002,.758,.869,.928,.966,.989,1.001,1.009,.546,.722,.841,.925,.977,1.003,1.023,.336,.541,.726,.871,.964,1.013,1.051,.153,.362,.615,.833,.975,1.051,1.107]),K=11,D=11,T=7;const N=[5.7814,6.7814,7.7814,8.7814,9.7814,10.7814,11.7814],e=class e extends AudioWorkletProcessor{constructor(){super(...arguments);r(this,\\\"phase\\\",0);r(this,\\\"normGain\\\",1);r(this,\\\"normTarget\\\",1);r(this,\\\"osW1\\\",0);r(this,\\\"osW2\\\",0);r(this,\\\"stepPos\\\",new Float64Array(3));r(this,\\\"stepAmp\\\",new Float64Array(3));r(this,\\\"nSteps\\\",0)}static get parameterDescriptors(){return[{name:\\\"skew\\\",defaultValue:0,minValue:-34e37,maxValue:34e37,automationRate:\\\"a-rate\\\"},{name:\\\"shape\\\",defaultValue:0,minValue:-34e37,maxValue:34e37,automationRate:\\\"a-rate\\\"},{name:\\\"normalize\\\",defaultValue:0,minValue:0,maxValue:1,automationRate:\\\"k-rate\\\"}]}static awBilinear(t,o,n,a,i,s){const h=(y,c)=>(y*D+c)*T+i,u=h(t,n),A=h(t+1,n),S=h(t,n+1),E=h(t+1,n+1),f=F[u]*(1-s)+F[u+1]*s,b=F[A]*(1-s)+F[A+1]*s,m=F[S]*(1-s)+F[S+1]*s,d=F[E]*(1-s)+F[E+1]*s,l=f*(1-a)+m*a,p=b*(1-a)+d*a;return l*(1-o)+p*o}static awGainLookup(t,o,n){const a=Math.min(Math.max(t,0),1)*(K-1),i=Math.min(Math.max(o,0),1)*(D-1),h=(Math.log2(Math.max(n,20))-N[0])/(N[T-1]-N[0]),u=Math.min(Math.max(h*(T-1),0),T-1),A=Math.min(Math.floor(a),K-2),S=a-A,E=Math.min(Math.floor(i),D-2),f=i-E,b=Math.min(Math.floor(u),T-2),m=u-b,d=e.awBilinear(A,S,E,f,b,m),l=e.awBilinear(A,S,E,f,e.AW_REF_FI,0);return l<=1e-6?d:l*Math.pow(d/l,e.AW_TILT)}static shapeMap(t,o,n,a){let i;if(o<=.5){const s=Math.abs(t);i=(t>=0?1:-1)*Math.pow(s,n)}else{const s=(o-.5)*2,h=Math.sin(t*Math.PI*.5);i=t+(h-t)*s}return a>0&&(i=(1-a)*i+a*(t>=0?1:-1)),i}static blep(t){if(t>=0){if(t>=1)return 0;const n=t-1;return-.5*n*n}if(t<=-1)return 0;const o=t+1;return .5*o*o}static eval(t,o,n){const a=Math.min(Math.max(o,.001),.999);let i;t<a?i=t/a:i=1-(t-a)/(1-a);const s=2*i-1;if(n<=.5){const h=Math.max(n*2,.05),u=Math.abs(s);return(s>=0?1:-1)*Math.pow(u,h)}else{const h=(n-.5)*2,u=Math.sin(s*Math.PI*.5);return s+(u-s)*h}}cornerSample(t,o,n,a,i,s,h,u){let A;t<o?A=t/o:A=1-(t-o)/(1-o);let S=2*A-1;n>0&&(S=(1-n)*S+n*(a?2*t-1:1-2*t));let E=e.shapeMap(S,i,s,h);const f=u>=0?1:-1;for(let b=0;b<this.nSteps;b++){let m=t-this.stepPos[b];m-=Math.round(m);const d=m/u;d>-1&&d<1&&(E+=f*this.stepAmp[b]*e.blep(d))}return E}process(t,o,n){const a=t[0]?.[0],i=o[0]?.[0];if(!i)return!0;const s=n.skew,h=n.shape,u=n.normalize[0]>.5,A=1/sampleRate,S=e.SMOOTH_COEFF,E=e.UPDATE_INTERVAL,f=e.SKEW_EDGE,b=e.SHAPE_EDGE;for(let m=0;m<i.length;m++){const d=a&&a.length>m?a[m]:440;let l=s.length>1?s[m]:s[0],p=h.length>1?h[m]:h[0];l=(l+1)*.5,p=(p+1)*.5,l=1-Math.abs((l%2+2)%2-1),p=1-Math.abs((p%2+2)%2-1);const y=d*A*.5;let c=0,W=!1;l<f?c=1-l/f:l>1-f&&(c=1-(1-l)/f,W=!0);let v=0,R=1;if(p<=.5){const M=p*2;R=M>b?M:b,M<b&&(v=1-M/b)}let B,I;if(v===0&&c===0)this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),B=e.eval(this.phase,l,p),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),I=e.eval(this.phase,l,p);else{const M=Math.min(Math.max(l,f),1-f),q=W?-1:1,C=W?2*M-1:1-2*M,j=W?1:-1,G=c>0?(1-c)*-1+c*q:-1,O=c>0?(1-c)*1+c*C:1,x=c>0?(1-c)*-1+c*j:-1;if(this.nSteps=0,c>0){const z=e.shapeMap(G,p,R,v)-e.shapeMap(x,p,R,v);z!==0&&(this.stepPos[this.nSteps]=0,this.stepAmp[this.nSteps++]=z)}v>0&&(G<0!=O<0&&(this.stepPos[this.nSteps]=M*(0-G)/(O-G),this.stepAmp[this.nSteps++]=O>G?2*v:-2*v),O<0!=x<0&&(this.stepPos[this.nSteps]=M+(1-M)*(0-O)/(x-O),this.stepAmp[this.nSteps++]=x>O?2*v:-2*v)),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),B=this.cornerSample(this.phase,M,c,W,p,R,v,y),this.phase+=y,this.phase>=1&&(this.phase-=1),this.phase<0&&(this.phase+=1),I=this.cornerSample(this.phase,M,c,W,p,R,v,y)}const{OS_B0:P,OS_B1:Q,OS_B2:U,OS_A1:L,OS_A2:_}=e;let V=B-L*this.osW1-_*this.osW2;this.osW2=this.osW1,this.osW1=V,V=I-L*this.osW1-_*this.osW2;let H=P*V+Q*this.osW1+U*this.osW2;this.osW2=this.osW1,this.osW1=V,u&&((m&E-1)===0&&(this.normTarget=e.awGainLookup(p,l,d)),this.normGain+=S*(this.normTarget-this.normGain),H*=this.normGain),i[m]=H}return!0}};r(e,\\\"OS_B0\\\",.20657),r(e,\\\"OS_B1\\\",.41314),r(e,\\\"OS_B2\\\",.20657),r(e,\\\"OS_A1\\\",-.36953),r(e,\\\"OS_A2\\\",.19582),r(e,\\\"UPDATE_INTERVAL\\\",32),r(e,\\\"SMOOTH_COEFF\\\",1-Math.pow(.05,1/32)),r(e,\\\"AW_TILT\\\",.35),r(e,\\\"AW_REF_FI\\\",2),r(e,\\\"SKEW_EDGE\\\",.01),r(e,\\\"SHAPE_EDGE\\\",.05);let k=e;registerProcessor(\\\"waveshaper\\\",k);})();\\n\";\n"],
|
|
5
|
+
"mappings": ";AAAA,IAAO,wBAAQ;;;ACAf,IAAO,qBAAQ;;;ACAf,IAAO,sBAAQ;;;ACAf,IAAO,qBAAQ;;;ACAf,IAAO,uBAAQ;;;ACAf,IAAO,qBAAQ;;;ACAf,IAAO,kBAAQ;;;ACAf,IAAO,wBAAQ;;;ACAf,IAAO,uBAAQ;;;ACAf,IAAO,uBAAQ;;;ACAf,IAAO,eAAQ;;;ACAf,IAAO,gBAAQ;;;ACAf,IAAO,wBAAQ;;;ACAf,IAAO,kBAAQ;;;ACAf,IAAO,2BAAQ;;;ACAf,IAAO,6BAAQ;;;ACAf,IAAO,oBAAQ;;;ACAf,IAAO,wBAAQ;;;ACAf,IAAO,iBAAQ;;;ACAf,IAAO,wBAAQ;;;ACAf,IAAO,qBAAQ;;;ACAf,IAAO,oBAAQ;;;ACAf,IAAO,cAAQ;;;ACAf,IAAO,sBAAQ;;;ACAf,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/docs/GUIDE.md
CHANGED
|
@@ -15,7 +15,7 @@ import { preload, Vco, Lfo, Vcf, semitones, hz, note } from '@jpdutoit/squelchy'
|
|
|
15
15
|
const ctx = new AudioContext();
|
|
16
16
|
await preload(ctx); // once per context, before any create()
|
|
17
17
|
|
|
18
|
-
const vco = Vco.create(ctx, { offset: semitones(45) }); //
|
|
18
|
+
const vco = Vco.create(ctx, { offset: semitones(45) }); // nothing in voct = note 0 (C-1); 45 semitones up = A2
|
|
19
19
|
const lfo = Lfo.create(ctx, { frequency: hz(0.2), amount: semitones(18) });
|
|
20
20
|
const filter = Vcf.create(ctx, { note: note('C6'), resonance: 4 });
|
|
21
21
|
|
|
@@ -27,6 +27,8 @@ filter.out.connect(ctx.destination);
|
|
|
27
27
|
lfo.output('out').connect(filter.input('modFreq'));
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
**Pitch is V/OCT plus `offset`.** A VCO plays the note on its `voct` input plus `offset` semitones, and it has no hidden "note" setting: Web Audio inputs can only add, so nothing can switch off when a cable arrives. With `voct` empty, the input is note 0 (C-1), so `offset` counts up from there: `semitones(69)` plays A4. To write the note by name, measure from note 0: `interval(note(0), note('A4'))`. With a sequencer or keyboard in `voct`, set `offset` to 0 to play the notes as written, or ±12 for an octave.
|
|
31
|
+
|
|
30
32
|
### Changing parameters: `set()` vs `params`
|
|
31
33
|
|
|
32
34
|
- **`params.<key>`** is a native `AudioParam` for every parameter that drives the DSP 1:1. Use it for anything timed: ramps, curves and `setValueAtTime`.
|
|
@@ -49,6 +51,21 @@ filter.params.resonance;
|
|
|
49
51
|
filter.dispose(); // disconnect and release when you're done
|
|
50
52
|
```
|
|
51
53
|
|
|
54
|
+
**Ramping pitch and cutoff.** Pitch and cutoff parameters are notes or semitones (a VCO's `offset`, filter cutoffs), so they are already logarithmic: every 12 is an octave. A `linearRampToValueAtTime` between two values sweeps evenly in pitch, which is usually what you want. `exponentialRampToValueAtTime` is the Hz habit: on a note parameter it curves the sweep a second time, so it crawls through the low end and rushes the top.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { preload, Vcf, note } from '@jpdutoit/squelchy';
|
|
58
|
+
|
|
59
|
+
const ctx = new AudioContext();
|
|
60
|
+
await preload(ctx);
|
|
61
|
+
const filter = Vcf.create(ctx, { filterType: 'bandpass', note: note('C4') });
|
|
62
|
+
const t = ctx.currentTime;
|
|
63
|
+
|
|
64
|
+
// A riser: 5 octaves, evenly in pitch over 4 seconds.
|
|
65
|
+
filter.params.note.setValueAtTime(note('C4'), t);
|
|
66
|
+
filter.params.note.linearRampToValueAtTime(note('C9'), t + 4);
|
|
67
|
+
```
|
|
68
|
+
|
|
52
69
|
## Units
|
|
53
70
|
|
|
54
71
|
Notes, semitones, Hz, seconds and beats are distinct types, so passing seconds where a note is expected won't compile. At runtime they are plain numbers with zero overhead. Dimensionless values (mix, feedback, drive) are plain `number`.
|
|
@@ -103,7 +120,7 @@ playOn(asPitch(lfo.out)); // deliberate: you said so
|
|
|
103
120
|
|
|
104
121
|
Musical positions are plain numbers in **beats** (quarter notes): bar 2 of a 4/4 song starts at beat 4, and a 16th note is 0.25. Audio times are `ctx.currentTime` seconds, as everywhere in Web Audio. Events are written ahead of time with exact start times, so timing doesn't depend on the main thread.
|
|
105
122
|
|
|
106
|
-
Bars and beats count from 0, as on a timeline: `{ bar: 0 }` is the first bar
|
|
123
|
+
Bars and beats count from 0, as on a timeline: `{ bar: 0 }` is the first bar, `{ bar: 1 }` starts at beat 4, and `{ bar: 1, beat: beats(2) }` is the third beat of the second bar (beat 6).
|
|
107
124
|
|
|
108
125
|
A **pattern** is a plain array, one element per step. A **voice** is anything with `trigger(time, hit)`, or a plain function `(time, hit) => void`.
|
|
109
126
|
|
|
@@ -122,7 +139,7 @@ transport.play(steps('..x. ..x. ..x. ..x.'), hat, {
|
|
|
122
139
|
every: beats(0.25), // step length in beats (default: 16ths)
|
|
123
140
|
swing: 0.3, // 0..1, delays every odd step
|
|
124
141
|
gate: 0.5, // note length as a fraction of a step
|
|
125
|
-
start: 'bar', // 'now' | 'beat' | 'bar' | { bar: n } | { beat: n }; default 'bar'
|
|
142
|
+
start: 'bar', // 'now' | 'beat' | 'bar' | { bar: n } | { bar: n, beat: n } | { beat: n }; default 'bar'
|
|
126
143
|
loop: true, // true = forever, false = once, n = n times
|
|
127
144
|
});
|
|
128
145
|
transport.start();
|
|
@@ -214,6 +231,8 @@ transport.stop(); // stop everything
|
|
|
214
231
|
|
|
215
232
|
`transport.at(position, fn)` calls `fn(time)` just ahead of that musical position, with its exact audio time, so you can schedule any `AudioParam` in musical time. It returns a cancel function.
|
|
216
233
|
|
|
234
|
+
`fn` runs a lookahead early, so it's the wrong place for UI. Pass `onAudible` for that: it fires when the position is actually heard, output latency included, just like `onHit`. Cancelling cancels both.
|
|
235
|
+
|
|
217
236
|
```ts
|
|
218
237
|
import { createTransport, preload, Vcf, note, sec } from '@jpdutoit/squelchy';
|
|
219
238
|
|
|
@@ -225,11 +244,12 @@ filter.out.connect(ctx.destination);
|
|
|
225
244
|
|
|
226
245
|
const bar = sec((transport.beatsPerBar * 60) / transport.bpm);
|
|
227
246
|
|
|
228
|
-
// Open the filter over two bars, starting at bar 3.
|
|
247
|
+
// Open the filter over two bars, starting at bar 3; tell the UI when the sweep is heard.
|
|
248
|
+
const showDrop = () => { /* update the screen */ };
|
|
229
249
|
const cancel = transport.at({ bar: 2 }, (t) => {
|
|
230
250
|
filter.params.note.setValueAtTime(note('C4'), t);
|
|
231
251
|
filter.params.note.linearRampToValueAtTime(note('C7'), t + 2 * bar);
|
|
232
|
-
});
|
|
252
|
+
}, { onAudible: showDrop });
|
|
233
253
|
transport.start();
|
|
234
254
|
// cancel(); // if you change your mind before it fires
|
|
235
255
|
```
|
|
@@ -249,15 +269,22 @@ const highlight = (step: number) => { /* light up step `step` */ };
|
|
|
249
269
|
|
|
250
270
|
transport.play(steps('x...x...'), kick, { onHit: (hit) => highlight(hit.step) }); // one playback
|
|
251
271
|
const unsubscribe = transport.onHit((hit) => console.log(hit.beat, hit.value)); // every playback
|
|
272
|
+
transport.at({ bar: 8 }, () => {}, { onAudible: () => highlight(-1) }); // a moment, not a hit
|
|
252
273
|
transport.start();
|
|
253
274
|
```
|
|
254
275
|
|
|
255
276
|
## Sequencing a synth voice
|
|
256
277
|
|
|
257
|
-
`NoteCv`
|
|
278
|
+
`NoteCv` works like a MIDI-to-CV interface. It turns pattern hits into three control signals:
|
|
279
|
+
|
|
280
|
+
- `gate`: 1 for each note's length, 0 between notes. Every hit opens it, soft or loud, like a hardware gate.
|
|
281
|
+
- `pitch`: the note number.
|
|
282
|
+
- `velocity`: how hard the note was hit (0 to 1). It holds until the next note, so the release keeps the level the note was played at.
|
|
283
|
+
|
|
284
|
+
Patch them like hardware: pitch into a VCO's `voct`, gate into an envelope's `trigger`, and velocity into whatever should follow the playing. Usually that's a VCA's `gain`, so soft notes come out quieter. With `voct` patched, the VCO's `offset` becomes a transpose, so set it to 0 to play the notes as written.
|
|
258
285
|
|
|
259
286
|
```ts
|
|
260
|
-
import { preload, createTransport, notes, semitones, sec, NoteCv, Vco, Envelope, Vcf, note } from '@jpdutoit/squelchy';
|
|
287
|
+
import { preload, createTransport, notes, semitones, sec, NoteCv, Vco, Envelope, Vcf, Vca, note, type Step, type Note } from '@jpdutoit/squelchy';
|
|
261
288
|
|
|
262
289
|
const ctx = new AudioContext();
|
|
263
290
|
await preload(ctx);
|
|
@@ -267,18 +294,39 @@ const cv = NoteCv.create(ctx);
|
|
|
267
294
|
const vco = Vco.create(ctx, { offset: semitones(0), skew: 1 });
|
|
268
295
|
const env = Envelope.create(ctx, { attack: sec(0.005), decay: sec(0.25), sustain: 0.2, release: sec(0.1), depth: semitones(36) });
|
|
269
296
|
const filter = Vcf.create(ctx, { note: note('C4'), resonance: 6 });
|
|
297
|
+
const amp = Vca.create(ctx, { gain: 0 }); // gain 0: the velocity CV alone sets the level
|
|
270
298
|
|
|
271
299
|
cv.pitch.connect(vco.voct);
|
|
272
300
|
cv.gate.connect(env.trigger);
|
|
301
|
+
cv.velocity.connect(amp.params.gain); // soft notes play quieter
|
|
273
302
|
vco.out.connect(filter.in);
|
|
274
303
|
env.env.connect(filter.modFreq); // the envelope also sweeps the cutoff, by `depth` semitones
|
|
275
304
|
filter.out.connect(env.in); // Envelope has a built-in VCA: in → out
|
|
276
|
-
env.out.connect(
|
|
305
|
+
env.out.connect(amp.in);
|
|
306
|
+
amp.out.connect(ctx.destination);
|
|
277
307
|
|
|
278
|
-
|
|
308
|
+
// Accents: velocity 1 on the downbeats, 0.4 elsewhere. Every note still opens the gate.
|
|
309
|
+
const line: Step<Note>[] = notes('C2 C2 . C3 . C2 Eb2 . G2 . C2 . Bb1 . C2 .')
|
|
310
|
+
.map((n, i) => (n === null ? null : { value: n, velocity: i % 4 === 0 ? 1 : 0.4 }));
|
|
311
|
+
transport.play(line, cv, { gate: 0.6 });
|
|
279
312
|
transport.start();
|
|
280
313
|
```
|
|
281
314
|
|
|
315
|
+
To change the notes on their way to the voice, wrap it in a function. `transpose()` keeps the result typed as a note:
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import { createTransport, notes, transpose, semitones, NoteCv, type Hit, type Note, type Seconds } from '@jpdutoit/squelchy';
|
|
319
|
+
|
|
320
|
+
const ctx = new AudioContext();
|
|
321
|
+
const transport = createTransport(ctx);
|
|
322
|
+
const cv = NoteCv.create(ctx);
|
|
323
|
+
|
|
324
|
+
let key = semitones(0);
|
|
325
|
+
const inKey = (time: Seconds, hit: Hit<Note>) => cv.trigger(time, { ...hit, value: transpose(hit.value, key) });
|
|
326
|
+
transport.play(notes('C2 . Eb2 G2'), inKey);
|
|
327
|
+
key = semitones(5); // later hits play a fourth up
|
|
328
|
+
```
|
|
329
|
+
|
|
282
330
|
## One-shot actions with `pulse()`
|
|
283
331
|
|
|
284
332
|
Actions like a tape stop or kicking the spring tank are **gate inputs**. They react to a rising edge, like a trigger cable on hardware. `pulse(input, time)` fires one at an exact time. It works the same whether it's called from a button, a pattern or `transport.at`, and it sums with anything else patched into that input.
|
|
@@ -354,8 +402,38 @@ transport.start();
|
|
|
354
402
|
|
|
355
403
|
A sample voice is one-shot, like a drum machine: every hit plays the whole sample, whatever the step's gate length. Its step value is a note, so the same `notes()` melody plays on a sampler and on a synth voice.
|
|
356
404
|
|
|
405
|
+
**Swapping kits while playing.** `voice.setKit(kit)` plays later hits from another kit. Patterns, connections and sidechains stay as they are, and samples already ringing (or scheduled within the lookahead) finish on the old kit, so nothing gets cut off.
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
import { createTransport, steps, loadSampleSet, SampleVoice } from '@jpdutoit/squelchy';
|
|
409
|
+
import { Tr909 } from '@jpdutoit/squelchy/kits/tr-909';
|
|
410
|
+
import { Roland808 } from '@jpdutoit/squelchy/kits/roland-808';
|
|
411
|
+
|
|
412
|
+
const ctx = new AudioContext();
|
|
413
|
+
const transport = createTransport(ctx);
|
|
414
|
+
const bd = SampleVoice.create(ctx, await loadSampleSet(ctx, Tr909), 'bd');
|
|
415
|
+
bd.connect(ctx.destination);
|
|
416
|
+
transport.play(steps('x...x...x...x...'), bd);
|
|
417
|
+
transport.start();
|
|
418
|
+
|
|
419
|
+
const tr808 = await loadSampleSet(ctx, Roland808);
|
|
420
|
+
bd.setKit(tr808); // hits scheduled from now on (about a lookahead ahead) play the 808
|
|
421
|
+
console.log(bd.kit.set.name);
|
|
422
|
+
```
|
|
423
|
+
|
|
357
424
|
**How the audio gets into your build.** A kit's voice URLs are written as `new URL('./tr-909/bd.flac', import.meta.url)`. Vite (8.3 or newer, in dev and build), webpack 5 and Parcel all recognise that pattern: they copy each file of the kits you import into your output with a content hash and rewrite the URL. Loading the package unbundled, e.g. from a CDN like jsDelivr, resolves the files next to the kit module.
|
|
358
425
|
|
|
426
|
+
**Vite 6 and 7 dev server.** In Vite 6 and 7, the dev server pre-bundles dependencies into `node_modules/.vite/deps/`. The kit's `import.meta.url` then points into that folder, where no audio files exist, and every voice gets the HTML page instead (`loadSampleSet` fails to decode). Production builds are not affected. Exclude the package from pre-bundling and the files resolve from the package itself:
|
|
427
|
+
|
|
428
|
+
```js
|
|
429
|
+
// vite.config.js
|
|
430
|
+
export default {
|
|
431
|
+
optimizeDeps: { exclude: ['@jpdutoit/squelchy'] },
|
|
432
|
+
};
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The package has no dependencies of its own and ships plain ES modules, so excluding it costs nothing. The package's own tests check this setup in dev and in a production build, using Vite 7 and Vite 8.3. Vite 8 needs no config (tested 8.0 and 8.3), and the setting is harmless there.
|
|
436
|
+
|
|
359
437
|
**Your own kit.** `loadSampleSet` takes any `SampleSetInfo`, so you can point voices at your own files:
|
|
360
438
|
|
|
361
439
|
```ts
|