You are not recognized as the original poster of this topic.
let SEED=4,hash=[
208,34,231,213,32,248,233,56,161,78,24,140,71,48,140,254,245,255,247,247,40,
185,248,251,245,28,124,204,204,76,36,1,107,28,234,163,202,224,245,128,167,204,
9,92,217,54,239,174,173,102,193,189,190,121,100,108,167,44,43,77,180,204,8,81,
70,223,11,38,24,254,210,210,177,32,81,195,243,125,8,169,112,32,97,53,195,13,
203,9,47,104,125,117,114,124,165,203,181,235,193,206,70,180,174,0,167,181,41,
164,30,116,127,198,245,146,87,224,149,206,57,4,192,210,65,210,129,240,178,105,
228,108,245,148,140,40,35,195,38,58,65,207,215,253,65,85,208,76,62,3,237,55,89,
232,50,217,64,244,157,199,121,252,90,17,212,203,149,152,140,187,234,177,73,174,
193,100,192,143,97,53,145,135,19,103,13,90,135,151,199,91,239,247,33,39,145,
101,120,99,3,186,86,99,41,237,203,111,79,220,135,158,42,30,154,120,67,87,167,
135,176,183,191,253,115,184,21,233,58,129,233,142,39,128,211,118,137,139,255,
114,20,218,113,154,27,127,246,250,1,8,198,250,209,92,222,173,21,88,102,219
];
function mod(x,y){return(x%y+y)%y;}
function noise2(x,y){
let tmp=hash[mod(Math.floor(y)+SEED,256)];
return hash[mod(tmp+Math.floor(x),256)];
}
function linInter(x,y,s){return x+s*(y-x);}
function smoothInter(x,y,s){return linInter(x,y,s*s*(3-2*s));}
function noise2D(x,y){
let xInt=Math.floor(x),yInt=Math.floor(y),
xFrac=x-xInt,yFrac=y-yInt,
s=noise2(xInt,yInt),
t=noise2(xInt+1,yInt),
u=noise2(xInt,yInt+1),
v=noise2(xInt+1,yInt+1),
low=smoothInter(s,t,xFrac),
high=smoothInter(u,v,xFrac);
return smoothInter(low,high,yFrac);
}
function perlin2D(x,y,freq,depth){
let xa=x*freq,ya=y*freq,
amp=1,fin=0,div=0;
for(let i=0;i<depth;i++){
div+=256*amp;
fin+=noise2D(xa,ya)*amp;
amp/=2;
xa*=2;ya*=2;
}
return fin/div;
}
let TAU=Math.PI*2,sine=x=>Math.sin(TAU*x),noteHz=n=>440*2**(n/12),chord=[0,3,7,10,14,15,17,22],slots=Array(chord.length*2).fill(0),SR=16000,mix=(a,b,x)=>a+x*(b-a),readArray=(a,i)=>{let fi=Math.floor(i),li=(i%1+1)%1,al=a.length;return mix(a[mod(fi,al)],a[mod(fi+1,al)],li);};
return function DSP(time){
let o=0,s=1.2,trans=readArray([-15,-12,-10,-5,-3,-7,-8],floor(time/s)+mod(time/s,1)**24);
for(let i=0;i<chord.length;i++){
o+=sine(slots[2*i])*perlin2D(i,time,10,3)**8+sine(slots[(2*i)+1])*perlin2D(chord.length+i,time+3,10,2)**8;
slots[2*i]+=(noteHz(chord[i]+.05+trans)+perlin2D(i-10,time*.5,10,2)*10)/SR;
slots[(2*i)+1]+=(noteHz(chord[i]+-.05+trans)+perlin2D(i-15,time*.8,7,2)*10)/SR;
}
return o*.3;
};