let ArrSiz = 12288;
let echoArray = Array(ArrSiz).fill(0);
synth.def( class {
constructor (options) {
this.phase = 0;
this.et = 0;
this.randomTranspose = Math.random()*7|0;
}
process(note, env, tick, options) {
this.et++;
this.phase += ditty.dt * 48e3;
let n = this.phase / 48e3 * Math.PI * 2 * 440 * 2 ** ([0,7,3,5,-3,0,3,-2][this.phase/32768&7]/12);
const wave = Math.sin( n + Math.sin(n*7+Math.sin(n*2)) +Math.sin(n/512)*4)*.1**(this.phase/32768%1);
echoArray[this.et%ArrSiz|0] = wave + echoArray[(this.et*2**(this.randomTranspose/12))%ArrSiz|0]/1.1;
let out = echoArray[this.et%ArrSiz|0];
return [(out-wave)/2+wave, (out-wave)/3+wave]; // left, right
}
}).play(0, { env: one} );