class EveFlowWakeProcessor extends AudioWorkletProcessor { constructor() { super(); this.buffer = new Float32Array(2048); this.offset = 0; } process(inputs) { const channel = inputs[0] && inputs[0][0]; if (!channel) return true; let i = 0; while (i < channel.length) { const n = Math.min(channel.length - i, this.buffer.length - this.offset); this.buffer.set(channel.subarray(i, i + n), this.offset); this.offset += n; i += n; if (this.offset === this.buffer.length) { this.port.postMessage(this.buffer, [this.buffer.buffer]); this.buffer = new Float32Array(2048); this.offset = 0; } } return true; } } registerProcessor('eveflow-wake', EveFlowWakeProcessor);