// test-processor.js
class TestProcessor extends AudioWorkletProcessor {
process(inputs, outputs, parameters) {
return true;
}
}
registerProcessor("test-processor", TestProcessor);AudioWorkletGlobalScope: registerProcessor() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const audioContext = new AudioContext();
await audioContext.audioWorklet.addModule("test-processor.js");
const node = new AudioWorkletNode(audioContext, "test-processor");
node.connect(audioContext.destination);