Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.45k stars 977 forks source link

Can't add Worklet module to Tone Context in FireFox #1205

Open javieraizpuru opened 1 year ago

javieraizpuru commented 1 year ago

After getting this error: #681 and changing the Tone Context to use a Tone.Context() object. I'm getting the error TypeError: can't access property "buffer", i[0][0] is undefined.

audioContext = new Tone.Context(); 
Tone.setContext(audioContext);
audioContext.addAudioWorkletModule('/js/phase-vocoder.js', 'phase-vocoder-processor');

The module used is phaze, but I don't think the problem is with the module since it works without ToneJS. I'm using Firefox Developer 117.0b9

marcelblum commented 1 year ago

Looks like audioWorklet support in Tone on Firefox is broken, likely an issue with standardized-audio-context, might be fixed in tone@latest if you haven't tried it. But you can also work around it by using native code via the unwrapped context: audioContext.rawContext._nativeAudioContext.audioWorklet.addModule("/js/phase-vocoder.js").then(...)

chrisguttandin commented 1 year ago

@javieraizpuru Is that a version of phaze which contains this fix? Could you please provide the stack trace of the error If you're already using the most recent version of phaze and Tone.js? Of course a minimal test case to reproduce the error would be even better.