
class AudioProcessor extends AudioWorkletProcessor{
constructor(options){
super();
this.lookup=options.processorOptions.lookup;
}
process(inputs,outputs){
const input=inputs[0][0];
if(!input)return true;
const encoded=new Uint8Array(input.length);
for(let i=0;i<input.length;i++)encoded[i]=this.lookup[Math.round(input[i]*5000+5000)];
this.port.postMessage(encoded);
return true;
}
}
registerProcessor('audio-processor',AudioProcessor);
