-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extendable OSC controller #982
Comments
Sooo, as it happens, I've actually built a mostly-complete, if still speculative, version of that in this branch. There's still some bugs with it, and maybe it makes sense broken up into a couple of PRs, but I can go back in soon and polish it up, and then we can do some review. |
Great, @mindofmatthew! Some polish and we should be good to go 👍 Compared to my suggestion, this doesn't make the whole OSC controller replaceable. Do you agree that we should implement that in addition to the changes you are already introducing? My view is that it would be good flexibility to provide. |
I haven't added the functions yet, but this would allow you to attach individual controls to a stream, like so: -- Add a new listener action (the returned Int can be used to remove the listener action later)
streamAddListener :: Stream -> String -> ([Value] -> IO ()) -> IO Int
-- A BootTidal abstraction
onOSC :: String -> IO () -> IO Int
onOSC name action = streamAddListener tidal name (\_ -> action)
onOSCArgs :: String -> ([Value] -> IO ()) -> IO Int
onOSCArgs = streamAddListener tidal
-- Which could be used like
onOSC "/button_1" $ d1 $ s "bd sn"
onOSC "/button_2" $ d2 $ silence
onOSCArgs "/knob_1" (\v:_ -> all (# lpf v)) I could see the usefulness of swapping out the listener at a higher level, but I don't have a clear sense of how it would fit in with this yet. Can you give me an example of how you're imagining it would be used? |
I would like to make the OSC controller abstract to the Stream module and not tie it directly to the new Sound.Tidal.OSC.Listener module. The motivation for my suggestion is to make the core simpler. It could also let someone experiment with other ways of implementing OSC controller extensibility or completely replacing the base commands. The individual controls could still be added like you imagine, but they would not be added to the Stream but instead to the instance of OSCListener. attachListenerActions would need to be received as an argument. It might be best that you complete your vision of your current change and that I make my changes in a separate PR since it can be difficult to get the idea across this way and you might not be so interested in completing my vision as it likely requires some elbow grease. |
This seems to be somehow related to: #677 And also Any thoughts on a way forward here? |
The good news and bad news is that all major development now is directed towards a 2.0 release, which means there's an opportunity for serious rewriting, but also it's going to take a while. Towards the previous point about simplifying the core, my thinking these days is that it's not necessary for the This means that it's probably possible to do what you're asking, @jarmitage, in a separate module that could be loaded in a BootTidal.hs file and attached to an existing Tidal stream. Are you primarily concerned with a mechanism for mapping OSC paths to Tidal control inputs? |
Does the same apply for OSC senders? Ideally there would be a similar UI/API for sending and receiving |
Yes, inasmuch as the That said, I imagine there will be a default interface for defining both OSC listeners and senders, and that the default Tidal configuration would expose all of this. The experience for the typical Tidal user might not be dramatically different than it is now, but the innards would allow a lot more lower-level customization. |
Ok, I'm out of the loop here... What do you suggest, should we create a new thread specifically about input/output UI (including OSC and possibly other things) in Tidal 2, or is it too early at this point |
This will be an orthogonal question to most other changes in 2.0 so I see no point in waiting. We need an overview of the use cases, a discussion about the preferred architecture, and that someone takes lead in the implementation. |
If OSC targets are not going to change in tidal 2, then why not follow the design I described in #677? |
As @mindofmatthew suggests, we might want to allow for other input/output than OSC. If that's our goal, the described design doesn't take us there. I personally have no use cases around this question at all, so I can only help with evaluating the different architectures we come up with l. It would be great if @mindofmatthew can list some use-cases where being bound to OSC would be detrimental. I like it because it seems cleaner but cleaner is not a great motivation for a large overhaul. |
In the interests of simplicity and not overhauling things without good reason, wouldn't it be better to assume that whatever IO people want with Tidal can be facilitated with OSC? We used to have tidal-midi but that never worked well. We could have sockets and/or websockets to complement OSC, or serial or something, but I don't see an urgent need for any of those. Anyone needing that connectivity would be able to go via OSC if needed. Adding more abstraction layers and protocols for IO seems like a lot of work for marginal gain, unless I'm missing a big set of use cases. #677 is a more incremental approach that would be immediately familiar for anyone who has written an OSC target before. @mindofmatthew how does your approach compare? |
My approach is ultimately that the Tidal stream wouldn't care what listener you have: tidal <- startStream config listeners
let myCtl = Controller
-- The default could be @jarmitage's design,
-- and a user could also swap in their own custom implementation
attachController tidal myCtl Non-OSC IO is definitely a nice outcome, but I agree it's pretty speculative. Setting that aside, here are more immediate use-cases:
|
For context, I'd also like OSC targets to behave similarly in Tidal 2, more like this: tidal <- startStream config
streamAddTarget tidal superdirt -- or whatever |
As requested by ghales in https://club.tidalcycles.org/t/rfc-improving-the-interface-for-interacting-with-tidal-streams/3528/4, Tidal could allow for extending the OSC controller. The requested idea is to allow callbacks to incoming OSC messages.
My suggested way to implement this would be to make the whole OSC controller replaceable and provided through configuration. The default configuration would be the current OSC controller. We should also create a function that returns an OSC controller that has the same base behaviour as currently + accepts a list of callbacks that are invoked for each incoming message.
The text was updated successfully, but these errors were encountered: