-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove white fast implementation
- Loading branch information
Showing
5 changed files
with
29 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const PROCESSOR = `"use strict";(()=>{function A(r,t){switch(t){case 0:return N;case 1:return R();case 10:return M(r);case 11:return P();default:return console.warn("Unknown noise type: "+t),N}}function N(r){for(let t=0;t<r.length;t++)r[t]=Math.random()*2-1}function R(){let r=4656612874161595e-25,t=1732584193,o=4023233417;return e=>{for(let n=0;n<e.length;n++)t^=o,e[n]=o*r,o+=t}}function M(r){let t=[0,0,0,0,0,0,0,0],o=[0,0,0,0,0,0,0,0],e=[0,0,0,0,0,0,0,0],n=0,h=0,a=c=>Math.pow(10,c/20),u=c=>20*Math.log10(c),l=0,i=0,p=0,m=r/(2*Math.PI)-1;for(;m>1;)t[l]=2*Math.PI*m/r,m=m/4,l++;for(h=l;l-- >0;)o[l]=a(i),p+=a(i),i-=6;return n=a(-u(p)),c=>{for(let f=0;f<c.length;f++){let b=Math.random()*2-1,d=0;for(let s=0;s<h;s++)e[s]=t[s]*b+(1-t[s])*e[s],d+=e[s]*o[s];c[f]=d*n}}}function P(){let r=[3.8024,2.9694,2.597,3.087,3.4006],t=[.00198,.01478,.06378,.23378,.91578],o=15.8564,e=[0,0,0,0,0],n=0;return h=>{for(let a=0;a<h.length;a++){let u=Math.random(),l=Math.random();for(let i=0;i<5;i++)if(u<t[i]){n-=e[i],e[i]=2*(l-.5)*r[i],n+=e[i];break}h[a]=n/o}}}var g=class extends AudioWorkletProcessor{r;t;d;constructor(){super(),this.r=!0,this.t=0,this.d=A(sampleRate,0),this.port.onmessage=t=>{switch(t.data.type){case"DISCONNECT":this.r=!1;break}}}process(t,o,e){return this.t!==e.type[0]&&(this.t=e.type[0],this.d=A(sampleRate,e.type[0])),this.d(o[0][0]),this.r}static get parameterDescriptors(){return[["type",0,0,100]].map(([t,o,e,n])=>({name:t,defaultValue:o,minValue:e,maxValue:n,automationRate:"k-rate"}))}};registerProcessor("NoiseWorkletProcessor",g);})();`; | ||
export const PROCESSOR = `"use strict";(()=>{function g(o,t){switch(t){case 0:return N;case 10:return P();case 11:return M(o);default:return console.warn("Unknown noise type: "+t),N}}function N(o){for(let t=0;t<o.length;t++)o[t]=Math.random()*2-1}function M(o){let t=[0,0,0,0,0,0,0,0],n=[0,0,0,0,0,0,0,0],e=[0,0,0,0,0,0,0,0],i=0,c=0,a=h=>Math.pow(10,h/20),u=h=>20*Math.log10(h),l=0,r=0,d=0,m=o/(2*Math.PI)-1;for(;m>1;)t[l]=2*Math.PI*m/o,m=m/4,l++;for(c=l;l-- >0;)n[l]=a(r),d+=a(r),r-=6;return i=a(-u(d)),h=>{for(let p=0;p<h.length;p++){let b=Math.random()*2-1,f=0;for(let s=0;s<c;s++)e[s]=t[s]*b+(1-t[s])*e[s],f+=e[s]*n[s];h[p]=f*i}}}function P(){let o=[3.8024,2.9694,2.597,3.087,3.4006],t=[.00198,.01478,.06378,.23378,.91578],n=15.8564,e=[0,0,0,0,0],i=0;return c=>{for(let a=0;a<c.length;a++){let u=Math.random(),l=Math.random();for(let r=0;r<5;r++)if(u<t[r]){i-=e[r],e[r]=2*(l-.5)*o[r],i+=e[r];break}c[a]=i/n}}}var A=class extends AudioWorkletProcessor{r;t;d;constructor(){super(),this.r=!0,this.t=0,this.d=g(sampleRate,0),this.port.onmessage=t=>{switch(t.data.type){case"DISCONNECT":this.r=!1;break}}}process(t,n,e){return this.t!==e.type[0]&&(this.t=e.type[0],this.d=g(sampleRate,e.type[0])),this.d(n[0][0]),this.r}static get parameterDescriptors(){return[["type",0,0,100]].map(([t,n,e,i])=>({name:t,defaultValue:n,minValue:e,maxValue:i,automationRate:"k-rate"}))}};registerProcessor("NoiseWorkletProcessor",A);})();`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters