MIDI-UI override

We’re working on some projects for festivals and needed something like this and thought other people could find it helpful. It is a TouchDesigner UI element that has a MIDI input. The two controls override each other in hard-takeover style.

The OPs to the left of the ‘midi_scale’ CHOPS, are a mock-MIDI input section. The Slider and Buttom COMPs to the right, would represent the UI elements in TouchDesigner.

To link a TouchDesigner UI element with an incoming MIDI channel, simply name the OP the same as whatever MIDI channel you want it to correspond with.
ex. If I have a slider on a MIDI controller that controls the brightness of a Level TOP elsewhere in the project, as well as a UI element that controls the same parameter, make sure the MIDI CHOP channel is renamed ‘brightness’ and the UI element (a slider in this case) is also named ‘brightness’. That way the proper MIDI channel is selected by the UI element.

As well there is a Text TOP background that references the OP name.

If everything is linked properly, the UI will now reflect any changes that are made with the MIDI controller, but can easily be over-ridden by the UI incases where the MIDI controller is not available.
midi_override_ex.4.toe (7.12 KB)

Hey Mattias, this is great!

I’ve been trying to do this with OSC messages for a while now. This provides the exact functionality I’m looking for.

I’d like to know more about the logic of this design. Everything makes sense to me except the script inside the CHOP Execute:

op(parent()).interact(val, 0.5, left=True)

Specifically the (val, 05, left=True)

If you could explain this a little further that would be greatly appreciated. I realize that this little script is the key thing I was missing in my own attempts and would like to learn the logic so I can implement this strategy in the future.

Thanks again, will be using this method on a project of my own

If you go to the wiki page for the Panel COMP class you can scroll down to the interact() method:
derivative.ca/wiki088/index. … COMP_Class

You’re basically faking mouse clicks on the slider where the first argument is the value on the slider, 0.5 just means “click in the middle of the slider”, and left=True means click with left mouse.

This method has be deprecated so its better in new versions to use the method closer to the top of the page called interactMouse. Should be pretty easy to convert the interact() to interactMouse() if you have any issues.