cutterbl / soundtouchjs-audio-worklet

AudioWorkletNode and AudioWorkletProcessor implementing SoundTouchJS
GNU Lesser General Public License v2.1
70 stars 10 forks source link

AudioWorkletProcessor is not defined #7

Closed rootux closed 3 years ago

rootux commented 3 years ago

When running this I get an error from soundtouch-worklet.js Uncaught ReferenceError: AudioWorkletProcessor is not defined.

How can it be? Shouldn't this be a native Chrome interface?

I'm importing this like so:

import createSoundTouchNode from '@soundtouchjs/audio-worklet/dist/soundtouch-audio-node';
import soundtouchWorklet from '@soundtouchjs/audio-worklet/dist/soundtouch-worklet';

And initializing it like so:

this._context = new AudioContext();
this._context.audioWorklet.addModule(soundtouchWorklet);

I'm getting this error: Uncaught ReferenceError: AudioWorkletProcessor is not defined.

I'm using the latest chrome and tested this project that does work for example - https://googlechromelabs.github.io/web-audio-samples/audio-worklet/basic/hello-audio-worklet/

cutterbl commented 3 years ago

If you look at the included example you will notice that I did not use import to add the module, but loaded directly from the file system. This is supposed to be possible, using plugins for handling worklets for whatever bundler you're utilizing, but I've never used one here myself.