Spaces:
Running
Running
Download capture-worklet.js from RyeAI/ekko-tiny-browser: direct link, hf CLI and curl.
- Browser
- Download file 595 Bytes
-
https://huggingface.co/spaces/RyeAI/ekko-tiny-browser/resolve/main/capture-worklet.js
- Command line
-
hf download hf://spaces/RyeAI/ekko-tiny-browser/capture-worklet.js
-
curl -L -o capture-worklet.js https://huggingface.co/spaces/RyeAI/ekko-tiny-browser/resolve/main/capture-worklet.js
595 Bytes
| class EkkoCaptureProcessor extends AudioWorkletProcessor { | |
| constructor() { | |
| super(); | |
| this.stopped = false; | |
| this.port.onmessage = (event) => { | |
| if (event.data?.type !== "stop") return; | |
| this.stopped = true; | |
| this.port.postMessage({type: "stopped"}); | |
| }; | |
| } | |
| process(inputs) { | |
| if (this.stopped) return true; | |
| const input = inputs[0]; | |
| if (input && input[0]) { | |
| const samples = new Float32Array(input[0]); | |
| this.port.postMessage(samples, [samples.buffer]); | |
| } | |
| return true; | |
| } | |
| } | |
| registerProcessor("ekko-capture", EkkoCaptureProcessor); | |