olvb / phaze

Real-time pitch-shifter as a Web Audio worklet, based on phase vocoder techniques
The Unlicense
134 stars 17 forks source link

Trying to initialize the AudioNodeWorklet but getting this error, any ideas why? #5

Closed 432player closed 3 years ago

432player commented 3 years ago

This error is pointing to the constructors

Uncaught TypeError: Failed to construct 'AudioWorkletProcessor': Please use the 'new' operator, this DOM object constructor cannot be called as a function. at PhaseVocoderProcessor.OLAProcessor (ola-processor.js?49c6:7) at new PhaseVocoderProcessor (phase-vocoder-worklet.js?dfb2:24)

olvb commented 3 years ago

It seems you are trying to directly instantiate a PhaseVocoderProcessor, instead of registering the worklet and then instantiating an AudioWorkletNode, as in:

await audioContext.audioWorklet.addModule('phase-vocoder.js');
let phaseVocoderNode = new AudioWorkletNode(audioContext, 'phase-vocoder-processor');

Take a look at main.jsfor more details.