munshkr / flok

Web-based P2P collaborative editor for live coding sounds and images
https://flok.cc
GNU General Public License v3.0
263 stars 40 forks source link

[strudel] AudioWorklet based effects don't work anymore #286

Closed felixroos closed 2 months ago

felixroos commented 6 months ago

using strudel effects that internally use AudioWorklets don't work anymore and result in silence:

s("bd*4").shape(.4)

this is the case for coarse, crush, shape (and dist, supersaw in the soon to be released version) getting:

[cyclist] error: Failed to construct 'AudioWorkletNode': AudioWorkletNode cannot be created: AudioWorklet does not have a valid AudioWorkletGlobalScope. Load a script via audioWorklet.addModule() first.

This seems to be happening since https://github.com/munshkr/flok/commit/205232cd6d968750c8c4daff58bbb9395ae981d3 was added. Not sure what the exact problem is, maybe initAudioOnFirstClick is called in the wrong place?

lukaprincic commented 2 months ago

these strudel effects would be so good to have in flok!

munshkr commented 2 months ago

Found a workaround: Before doing anything, if you click somewhere outside the editor pane, it will call the click event added by initAudioOnFirstClick, effectively initializing the audio worklet:

image
munshkr commented 2 months ago

@felixroos @lukaprincic I think it's working now :)

lukaprincic commented 2 months ago

wow, thank you so much!!