Port p5dirt to p5.js / issue with tidal's use of messaging over udp

I was trying to port p5dirt from processing to p5.js (for those unfamiliar, p5dirt is a very basic program allowing tidal parameters be sent to processing sketches). I feel like a tidal-p5.js integration would be valuable to implement, considering p5.js is focused on visuals, great for beginners, and can run on a wide variety of different platforms.

However, a big barrier I’ve run into is that tidal uses udp sockets to connect with supercollider, when no browser currently supports opening udp sockets. I have a base understanding of tidal’s internals, but I’m not too familiar with open sound control or any networks (tcp, udp, websocket, etc).

Any idea how hard it might be to change tidal’s internals from udp to tcp?

Hi @Dsm0,

My knowledge might be out of date on this, but as far as I know the only browsers supporting raw TCP sockets are in Firefox OS. Most browsers do support the WebSocket protocol, which wraps TCP with some extra handshaking steps for security. Unfortunately this means that Tidal would need to change to use websockets instead of an arguably much simpler change from UDP -> TCP.

To put it slightly differently, even if the underlying transport layer of WebSockets could use UDP (it can’t) Tidal would still have to implement the WebSocket handshaking protocol to get direct Tidal -> Browser communication happening.

I would instead suggest writing a OSC -> WebSocket bridge, or looking at the many existing solutions for this (for example: https://www.npmjs.com/package/osc).

Alternatively, Mariana Pachon-Puentes has made a very simple example integrating a PEG for the Tidal mini-notation with p5.js: https://github.com/gibber-cc/tidal.pegjs/tree/p5-implementation

And perhaps @dktr0 has done experiments with p5 in Estuary?

Haven’t done anything with P5 thus far but the superDirtSocket developed some time ago for (and still works with) Estuary is probably relevant to this discussion I think. https://github.com/dktr0/SuperDirtSocket