class VoiceCapture extends AudioWorkletProcessor { constructor() { super(); this.buffer = new Float32Array(1024); this.pos = 0; } process(inputs) { const channel = inputs[0]?.[0]; if (channel) { for (const x of channel) { this.buffer[this.pos++] = x; if (this.pos === this.buffer.length) { this.port.postMessage(this.buffer, [this.buffer.buffer]); this.buffer = new Float32Array(1024); this.pos = 0; } } } return true; } } registerProcessor("ffv-capture", VoiceCapture);