You are not recognized as the original poster of this topic.
var sampleRate=8000,
f=t=>10*(t>>7|t|t>>6)+4*(t&t>>13|t>>6);
function mod(a,b){return(a%b+b)%b;}
function clamp(x,mn,mx){return min(max(x,mn),mx);}
function bytebeatToFloat(f,t){return((mod(f(floor(t*sampleRate)),256)/255)*2)-1;}
class biquad{
constructor(){
this.y1=0;this.x1=0;
this.y2=0;this.x2=0;
}
process(x,b0,b1,b2,a1,a2){
let o=b0*x+b1*this.x1+b2*this.x2-a1*this.y1-a2*this.y2;
if(!isFinite(o))o=x;
this.x2=this.x1;this.x1=x;
this.y2=this.y1;this.y1=o;
return o;
}
}
class compressor{
constructor(){
this.minDiv=1e-4;this.div=1;
}
process(x,speed=1){
this.div=max(this.minDiv,abs(x),this.div-(speed/sampleRate));
return x/this.div;
}
}
class convolution{
constructor(l=16){
this.l=l;
this.b=new Array(l).fill(0);
this.m=[];
for(let i=0;i<l;i++)
this.m.push(((1-(abs((i/l)-.5)*2))**51)+((Math.random()*2)-1)*.3);
this.i=0;
}
process(x,t){
let s=0;
this.b[this.i]=x;
for(let j=0;j<this.l;j++)
/*s+=this.b[j]*this.m[j];*/s+=this.b[floor(mod(this.i-j,this.l))]*this.m[j]; //the indexing is wrong
this.i=(this.i+1)%this.l;
return s;
//return this.b[this.i]-this.b[mod(this.i+1+floor((sin(t*6)+1)*2000),this.l)]; //cool wonky effect
//return this.b[mod(this.i+(floor((t*14e3)+sin(t*5)*500)%9300),this.l)];
}
}
let b=[],comp=new compressor(),conv=new convolution(1300);
for(let i=0;i<16;i++)b.push(new biquad());
return t=>{
let m=bytebeatToFloat(f,t*41.14);
for(let i=0;i<b.length;i++){
m=b[i].process(m,
sin(t/(i+1))/2,cos(t*(i+1))*0.3,sin(t+i)/5,sin(t*(1+i)-i)/4,cos(t*.2)/20);
}
m=conv.process(m,t);
return clamp(comp.process(clamp(m,-1,1),2e10)*2,-.9,.9);
};