Possible Web version with WASM + Tone.js?

Hi! I've been thinking a lot about the possibility of running standalone TidalCycles + SuperDirt on the browser, and the limitations of existing tools (ie. flok will let you run tidal but you still need SuperCollider running to make sound). I'm curious if there's any progess being made or overall interest in this.

For Tidal, it's possible to compile it to WASM (there are a couple of experimental haskell-wasm compilers), or to port it to Purescript (no idea how hard this is). As for SuperDirt, porting it to Tone.js seems to be the only way.

This is an interesting idea and with something like this I first think of a prototype to see if it is practicable/performant. I've had a look at the API of Tone.js and the first problem I see is that there is no OSC interface to Tone.js (or I just overlook it). This would have to be completely implemented and adapted to TidalCycles.

In principle, TidalCycles does not care where it sends its OSC messages to. There are also approaches to use Max/MSP with Tidal. How complex was/is it there to implement?

Since TidalCycles has its own clock, it must somehow be synchronized with Tone.js or Tone.js clocks must be ignored. And you would have to create a general interface for synthesizer/sampler, effects and their parameters. This is also what SuperDirt does in essence, as far as I understood.

But I also cannot estimate how effort and benefit are in relation to each other. But anything that creates an easy installation/environment for Tidal should be welcome!

Great topic! @dktr0 and team have done a lot of work on this as part of the estuary collaborative live coding ecosystem. In a way getting tidal running in the browser isn't the hardest part - David has done this with ghcjs I think. The problem is getting the haskell interpreter running in the browser. David has got around this by making a parser for a useful subset of haskell, with the tidal-parse library that you can find in the tidal repo. The Hamilton crew have also made a port of dirt called webdirt.

OSC isn't necessary, if it is all running in the browser you can schedule and trigger things more directly.

I did look at porting to purescript a long time ago. It was missing something major, maybe higher order types, that made it tricky. That might will have been fixed by now.

Sorry for lack of links.. On my phone...