Loading...
const node = ctx.createScriptProcessor(1024, 1, 1);
node.onaudioprocess = (e) => processAudio(e);await ctx.audioWorklet.addModule('processor.js');
const node = new AudioWorkletNode(ctx, 'my-processor');
source.connect(node).connect(ctx.destination);ScriptProcessorNode is deprecated and runs on the main thread; an AudioWorkletNode runs on the audio thread.
ScriptProcessorNode and getting glitches when the main thread is busy.port.postMessage().process() in my AudioWorklet stop being called?Returning false lets the browser stop the processor once it has no active inputs. Return true to keep it running.
process() get at a time?It usually receives blocks of 128 frames per channel, called a render quantum.
Yes. audioWorklet is available only in secure contexts, which include localhost.