tidalcycles / strudel

Web-based environment for live coding algorithmic patterns, incorporating a faithful port of TidalCycles to JavaScript
https://strudel.cc/
GNU Affero General Public License v3.0
674 stars 117 forks source link

Custom OSC targets and documentation #623

Open jarmitage opened 1 year ago

jarmitage commented 1 year ago

Tidal has facilities and docs for defining "OSC Targets": https://tidalcycles.org/docs/configuration/MIDIOSC/osc

Strudel currently only supports SuperDirt's OSC protocol: https://strudel.tidalcycles.org/learn/input-output

Here's the code:

https://github.com/tidalcycles/strudel/blob/b0a8d121120d301dcf1131c4f8c2dec9a067abfa/packages/osc/osc.mjs#L39-L70

It would be great to be able to define OSC Targets for using Strudel to control other things, with some docs to go with it.

As an example, @freeeco wants to control Toybox in Reaktor similar to this https://cdm.link/2020/11/free-nano-community-modules-for-reaktor-blocks-with-tidalcycles-support-and-tons-of-toys/

As an additional thought, OSC inputs to Tidal have been a topic for a while:

OSC inputs to Strudel might be quite useful in various cases too, something to consider.

Another thought, regarding https://github.com/tidalcycles/strudel/issues/33, perhaps there should be a separation between schema and protocol, i.e. you could potentially use the same schema over OSC, WebRTC, etc.

felixroos commented 1 year ago

setting target / port / address could work with regular params which are then used by osc:

x.target('name').port(3128).address('127.0.0.1').osc()

I think the dirt/play prefix should actually be removed + a new .superdirt function should be added with that prefix intact, see https://github.com/tidalcycles/strudel/pull/63#issuecomment-1204495437

here's an example of how you'd get custom osc messages: https://strudel.tidalcycles.org/?XhW1Hcn-MriE this will send messages like dirt/play/x/1/y/3 or x/1/y/3 when dirt/play is removed.

is it a limiting factor if the message always uses key value pairs?

using ":" syntax, it is also possble to get array values: https://strudel.tidalcycles.org/?vigTL4LDX9dv although osc will currently still turn those into key value pairs, meaning [ 2, "arbitrary", "arguments" ] turns into 0/2/1/arbitrary/2/arguments. but maybe key value pairs are just fine.. i haven't used osc enough to know