You are not recognized as the original poster of this topic.
function shuffle(array){
for(let i=array.length-1;i>=0;i--){
const j=Math.floor(Math.random()*(i+1));
[array[i],array[j]]=[array[j],array[i]];
}
}
let mix=(a,b,x)=>a+x*(b-a),delays=[],last=[],route=[],mult=[],del=[],sampleRate=8000;
for(let i=0;i<30;i++){
delays.push(new DelayLine({
maxDelayInSamples:sampleRate,
numChannels:1,
interpolationType:"linear"
}));
del.push(mix(10,200,Math.random()**.5));
delays[i].setDelay(del[i]);
last.push(0);route.push(i);mult.push(mix(.85,.94,Math.random()));
}
shuffle(route);
let processDelays=(x,time)=>{
let o=x;
for(let i=0;i<delays.length;i++){
delays[i].pushSample(0,o-last[route[i]]*mult[i])
delays[i].setDelay(del[i]+sin(i**3.8+time*1.4)*60);
last[route[i]]=delays[i].popSample(0);
o+=last[route[i]]*.12
}
return o;
};
return t=>{
let o=(sin(PI*2*200*t)*(1-t%[.23,.3,.23,.55][(t*.7|0)%4])**90)+(Math.random()*(1-t%[.2,.5,.63,.7][(t*1.3|0)%4])**100)*.2;
o=processDelays(o,t);
return Math.tanh(o);
};