Momentary button to send effect with max value

3.08K viewsCSS Questions
0

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

Rouz Answered question
Attached Files:
0

Hi again,

just tested your new script and it is not fully working for me.

Triggering Sends in global mode works fine, but once a button is clicked in SHIFT mode, then the script doesn’t work anymore. The button triggered is then not reacting anymore.

My config:

shift_offset = 2
track_offset = 0

buttons = {
  1 : self.c_instance.midi_cc_ch_0_val_61,
  2 : self.c_instance.midi_cc_ch_0_val_62,
  3 : self.c_instance.midi_cc_ch_0_val_61, # shift mode
  4 : self.c_instance.midi_cc_ch_0_val_62, # shift mode
  5 : self.c_instance.midi_cc_ch_0_val_63,
  6 : self.c_instance.midi_cc_ch_0_val_64,
  7 : self.c_instance.midi_cc_ch_0_val_63, # shift mode
  8 : self.c_instance.midi_cc_ch_0_val_64, # shift mode
}

In CSS I adjusted the 4 button listeners to match the ones from above.

Worth noting is that the first time I use the SHIFT mode on buttons[1] (my example above), then Send[1] is send to max (and not Send[3] as expected). After that it crashes and buttons[1] is not reactive anymore. There are no logs from the error.

Also, when triggering buttons[5] & buttons[6], I would expect Channel 2’s Send[1] & Send[2] to be send to max respectively. But buttons[5] & buttons[6] are not reactive, nothing happens.

Rouz Posted new comment

Hey Rouz, could it be that you didn’t change Listeners in the “Shift reaction”? You need to change the Listeners in both Reactions, make sure the Listeners are listed in the same order in both Reactions. That’s the downside of this 2 Reaction implementation; but the upside is you shouldn’t need to check mode numbers manually.

Ah, i also see you doubled the button objects in that dictionary, but it isn’t necessary. Put each object in once, it will be used for both Main mode and Shift mode.

OK I see. I changed the buttons to:

buttons = {
1 : self.c_instance.midi_cc_ch_0_val_61,
2 : self.c_instance.midi_cc_ch_0_val_62,
3 : self.c_instance.midi_cc_ch_0_val_63,
4 : self.c_instance.midi_cc_ch_0_val_64
}

Same order i have in the MAIN (global mode) and SHIFT (shift mode) reactions. The error is the same:
It works fine unless I use the shift mode, then it crashes and nothing works anymore

I think the problem will be that MAIN is in global mode.
Solution is to use a non-global, non-shift mode for MAIN.

I designed this new version around making the function only work in 1 mode + the shift mode. That way, you can still use all those buttons in other modes with different functionality.

If you did want to use those buttons with this same functionality in other Modes, I think you could simply duplicate the MAIN reaction, and set it to that other mode, and then this function would work in that mode as well. I’ve not tested this yet but I believe it would work.

If you wanted this to work in Global Mode, then I’ve gone and overcomplicated things. I can simplify it again, if that’s what you’d want.

I might not have put in error handling for when you would’ve used Global Mode in the MAIN reaction; that’s why you’re not seeing any errors. I’ll update the user.py for that, then leave a comment here when I’ve uploaded it to the drive.

Yes you are right. Once I changed it to a specific mode it’s working as expected. Super dope! Cheers Glenn amazing work

Thanks. Let me know if you find a bug, I’ll update the files.

I just tested duplicating the Main Reaction and giving it another Mode and it works as I thought, it makes the function available in both MAIN modes + in the SHIFT mode when pressing shift from a MAIN mode.

Will do, most definitely

You are viewing 1 out of 16 answers, click here to view all answers.