Spaces:
Running on Zero
Running on Zero
Download assets/capture.js from fffiloni/fastframes-voice: direct link, hf CLI and curl.
- Browser
- Download file 539 Bytes
-
https://huggingface.co/spaces/fffiloni/fastframes-voice/resolve/main/assets/capture.js
- Command line
-
hf download hf://spaces/fffiloni/fastframes-voice/assets/capture.js
-
curl -L -o capture.js https://huggingface.co/spaces/fffiloni/fastframes-voice/resolve/main/assets/capture.js
539 Bytes
| 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); | |