Momentary button to send effect with max value
I have a momentary button and I wanna send my send1 to max value (127). I also have a Knob1 that controls the send1. But additionally I want to have a that momentary button. For some reason I can’t manage to send the value of the send1 to max when pressed.
I tried with reaction, but without success (but maybe there is a easier way):
Listener: Button 1o was pressed
Action Block1:
Condition: Button 10 latest velocity value is equal – 127
Action: MIDI Controller – send MIDI velocity value to Controller input Knob1 Value 127
Action Block2:
Condition: Button 10 latest velocity value is not equal – 127
Action: MIDI Controller – send MIDI velocity value to Controller input Knob1 Value 0
Maybe it’s wront to send the velocity value to Knob1, but I couldn’t find an option how to set the send1 directly.
Any ideas on how I can achieve this?
Any help is appreciated
Hey Rouz, I made a user.py version today. The code I presented earlier wasn’t without some bugs. Also, to make it work in the user.py file I had to do a few adjustments. Here’s a link to the file on my google drive.
Some notes
To be able to access functions and objects from the Control Surface Script itself, it’s necessary to make a class variable from c_instance (which is an instance of the script and all it’s functions). Simply using self. inside the User class with the objects from that script wouldn’t work; in the way I implemented it you need to put self.c_instance before those objects.

This will become more obvious once you read the code. For example, the button references are part of the Control Surface Script so we need self.c_instance to access those.
The function I made for your request is at the bottom. In this user.py file there are a few other functions, most are unused in this case (but might prove useful for future projects). If you rather copy the function I made for you to your own user.py script, then you should also copy the following:
- the self.c_instance variable inside the __init__ (that I mentioned above)
- the log method, which I’ve used in the error handling of the function (or you could delete or change all the times log is called upon). I prefer this log method because I can add a little descriptor before a message, which makes it easier to find certain messages in the log.

The function takes at least 1 argument, the listener number. The variable for the listener number inside a reaction is called reaction_listener_number. The keyword arguments are not necessary to fill in, they will default to the following:
- track_num will be the position of the selected track
- send_num will be listener_num – 1 (because listener_num starts at 1 but send index starts at 0)
You’ll still need to change the channel and value of the button references inside the function to match those of your buttons. At the moment they are set to the buttons on my device.

How to set up a Reaction with the function
- Add the Listeners you want to use, in order, to the Reaction
- Create an Action, convert it to a Custom Code Block and add:
self.user.full_on_press_reset_on_release(reaction_listener_number) - Save and generate the script. If the user.py file is in the correct position, then it should work.
However…
You’ve mentioned that you want to use a shift mode, which means that depending on the mode, a button might have to control a different send. The current state of the code doesn’t take this in account.
One way you could alter the code is adding an offset to the send index when you’re in shift mode. Each mode is part of a list. You can retrieve the position of a mode in that list via self.get_active_mode_number() (although, if you want to use that code inside the user.py file, you’ll need self.c_instance again. Once you know the position number of the shift mode, you can do something like the following:
shift_mode_num = ... # this should hold the number of the shift_mode in your script current_mode = self.c_instance.get_active_mode_number() if send_num is None: send_num = listener_num - 1 if shift_mode_num == current_mode: send_num += 2 # I'm using 2 here because you mentioned that sends 3 and 4 were on the shift mode
Let me know how it works on your end.
Sign up
User registration is currently not allowed.