-
Notifications
You must be signed in to change notification settings - Fork 17
/
jsfxr.min.js
8 lines (8 loc) · 3.1 KB
/
jsfxr.min.js
1
2
3
4
5
6
7
8
function F(){this.w=function(a){a=a.split(",");this.s=a[0]|0;this.b=1*a[1]||0;this.a=1*a[2]||0;this.A=1*a[3]||0;this.d=1*a[4]||0;this.q=1*a[5]||0;this.l=1*a[6]||0;this.n=1*a[7]||0;this.j=1*a[8]||0;this.D=1*a[9]||0;this.r=1*a[10]||0;this.c=1*a[11]||0;this.i=1*a[12]||0;this.z=1*a[13]||0;this.t=1*a[14]||0;this.m=1*a[15]||0;this.g=1*a[16]||0;this.h=1*a[17]||0;this.e=1*a[18]||0;this.v=1*a[19]||0;this.o=1*a[20]||0;this.k=1*a[21]||0;this.u=1*a[22]||0;this.p=1*a[23]||0;0.01>this.a&&(this.a=0.01);a=this.b+
this.a+this.d;0.18>a&&(a=0.18/a,this.b*=a,this.a*=a,this.d*=a)}}
var S=new function(){this.f=new F;var a,f,d,e,i,v,G,H,I,w,j,J;this.reset=function(){var a=this.f;e=100/(a.q*a.q+0.0010);i=100/(a.l*a.l+0.0010);v=1-0.01*a.n*a.n*a.n;G=1E-6*-a.j*a.j*a.j;a.s||(j=0.5-a.z/2,J=5E-5*-a.t);H=0<a.c?1-0.9*a.c*a.c:1+10*a.c*a.c;I=0;w=1==a.i?0:2E4*(1-a.i)*(1-a.i)+32};this.C=function(){this.reset();var e=this.f;a=1E5*e.b*e.b;f=1E5*e.a*e.a;d=1E5*e.d*e.d+10;return a+f+d|0};this.B=function(T,K){var b=this.f,L=1!=b.e||b.k,n=0.1*b.k*b.k,M=1+3E-4*b.u,k=0.1*b.e*b.e*b.e,U=1+1E-4*b.v,V=
1!=b.e,W=b.p*b.p,X=b.l,N=b.g||b.h,Y=0.2*b.h*b.h*b.h,z=b.g*b.g*(0>b.g?-1020:1020),O=b.m?(2E4*(1-b.m)*(1-b.m)|0)+32:0,Z=b.A,P=b.D/2,$=0.01*b.r*b.r,A=b.s,B=a,aa=1/a,ba=1/f,ca=1/d,b=5/(1+20*b.o*b.o)*(0.01+k);0.8<b&&(b=0.8);for(var b=1-b,C=!1,Q=0,r=0,s=0,x=0,p=0,t,q=0,g,l=0,o,D=0,c,R=0,m,E=0,y=Array(1024),u=Array(32),h=y.length;h--;)y[h]=0;for(h=u.length;h--;)u[h]=2*Math.random()-1;for(h=0;h<K;h++){if(C)return h;O&&++R>=O&&(R=0,this.reset());w&&++I>=w&&(w=0,e*=H);v+=G;e*=v;e>i&&(e=i,0<X&&(C=!0));g=e;0<
P&&(E+=$,g*=1+Math.sin(E)*P);g|=0;8>g&&(g=8);A||(j+=J,0>j?j=0:0.5<j&&(j=0.5));if(++r>B)switch(r=0,++Q){case 1:B=f;break;case 2:B=d}switch(Q){case 0:s=r*aa;break;case 1:s=1+2*(1-r*ba)*Z;break;case 2:s=1-r*ca;break;case 3:s=0,C=!0}N&&(z+=Y,o=z|0,0>o?o=-o:1023<o&&(o=1023));L&&M&&(n*=M,1E-5>n?n=1E-5:0.1<n&&(n=0.1));m=0;for(var da=8;da--;){l++;if(l>=g&&(l%=g,3==A))for(t=u.length;t--;)u[t]=2*Math.random()-1;switch(A){case 0:c=l/g<j?0.5:-0.5;break;case 1:c=1-2*(l/g);break;case 2:c=l/g;c=0.5<c?6.28318531*
(c-1):6.28318531*c;c=0>c?1.27323954*c+0.405284735*c*c:1.27323954*c-0.405284735*c*c;c=0>c?0.225*(c*-c-c)+c:0.225*(c*c-c)+c;break;case 3:c=u[Math.abs(32*l/g|0)]}L&&(t=q,k*=U,0>k?k=0:0.1<k&&(k=0.1),V?(p+=(c-q)*k,p*=b):(q=c,p=0),q+=p,x+=q-t,c=x*=1-n);N&&(y[D%1024]=c,c+=y[(D-o+1024)%1024],D++);m+=c}m*=0.125*s*W;T[h]=1<=m?32767:-1>=m?-32768:32767*m|0}return K}};
window.jsfxr=function(a){S.f.w(a);var f=S.C(),a=new Uint8Array(4*((f+1)/2|0)+44),f=2*S.B(new Uint16Array(a.buffer,44),f),d=new Uint32Array(a.buffer,0,44);d[0]=1179011410;d[1]=f+36;d[2]=1163280727;d[3]=544501094;d[4]=16;d[5]=65537;d[6]=44100;d[7]=88200;d[8]=1048578;d[9]=1635017060;d[10]=f;for(var f=f+44,d=0,e="data:audio/wav;base64,";d<f;d+=3)var i=a[d]<<16|a[d+1]<<8|a[d+2],e=e+("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i>>18]+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i>>
12&63]+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i>>6&63]+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i&63]);d-=f;return e.slice(0,e.length-d)+"==".slice(0,d)};