How to get an OP execute to keep cooking when the network is not displayed

hi there,
I am trying to get an Op Execute DAT to cook when the network is not displayed, or in perform mode.

In a Base component I have an OP exec, set on post cook, detecting an incoming MIDI cc message, and sending some values downstream.
The OP exec does its job very well, but only when the network is displayed in the editor. (if you go up one level to /project1/ you will see that the rectangle stops rotating)
I have tried to set the null CHOP feeding the OP exec to “always cook”, but I get a different misbehaviour (the rectangle keeps spinning)

I have attached the file below. I am getting an incoming MIDIcc message to keep rotating a TOP, even when it has reached its end value (0 or 127), so that the MIDI encoder could be used like an endless rotary encoder.
It’s based on the observation that when the knob has reached one end, it keeps outputting data, either 0 or 127, depending on which direction we are spinning the knob, getting the MidiIN CHOP to cook in TD.
it’s a neat simple network and it works perfectly fine, but only when displayed in the editor!
The code has been tested on a MIDI BCR2000, and it should work on any MIDI controller with endless knobs (like an APC40 mk2 for example).

I intend to put this component in the shared tox section, but first I would like to get it to work properly.

any help of hint to send me in the right direction would be appreciated!

Midi endless knob v2.toe (4.4 KB)

In this case I would use a CHOP Execute DAT, and use its onValueChange callback. (instead of using an OP Execute DAT). I think that should solve your issue - am I correct?

HI Nettoyeur,
thank you so much for your help.

Unfortunately using a Chop Exec DAT set to onValueChange does not work.
That’s because when the MIDI knob reaches on end, either 0 or 127, it stops sending values, therefore the ChopExec Dat won’t run any script because the value is not changing anymore.
However, what happens, the MIDI knob still sends “something” when I keep rotating it clockwise or counterclockwise, causing the MidiIN CHOP to cook. That’s why I tried to approach this with an OP Exec DAT, which has the pre-cook and post-cook options…

any other hint that you might think of?

Ah oops sorry - I obviously did not read your question well enough before I answered, sorry about that :wink:
In that case a more error-proof solution could be to use a Midi In DAT instead of a CHOP, and copy/paste your custom Python lines within its onReceiveMIDI callback. (add any if/else lines to execute only on certain messages). This would remove the need for any CHOP/OP Execute DATs and also guarantees your Python code is always executed whenever any matching midi message arrives.

It works perfectly! Midi IN DAT it is!!!
thank you so much for your help!

here below the link to shared .tox.
Version 1 uses a Midi out CHOP to provide some sort of feedback to the MIDI controller.
Version 2 is the one I was working on these days, it uses the MIDI in DAT and it’s way more simplified than v1.

This is something that came up on the Facebook page which sparked my interest.

Thanks again for your time.

1 Like