Momentary Button Widget

Hi - my first post so go easy on me! I am trialling GP at the moment and it looks like it’s going to work very well for me. One thing I have not been able to work out is how to add a momentary button widget as opposed to a latching switch to a panel. Am I missing something obvious?

Unfortunately, there actually is no widget with such a functionality. I am missing that too from time to time, but i always found a way around.
In the worst case one has to use GPscript to make the widgets do what they should.
What is it exactly, that you want to do - maybe we can help you?

Yes - could you please explain exactly what would you do with such a button and are you planning on connecting it to your MIDI controller or OSC perhaps?

Hi - I have a drum sampler (Sitala) that I use for triggering sound effects with momentary buttons on my midi controller. When I link the controller button to a panel switch via midi and hit the button on the controller I get the desired behaviour (the switch widget flashes on then off). However, if I click on the widget with my mouse I get a latching behaviour. It’s not a deal breaker but it is a bit counter intuitive.

Understood. Yes - the issue is only if you click on the button widget. We’ll put it into our feature tracking system so we implement some kind of option that makes the button momentary if one clicks on it.
Thanks

8 Likes

(unfortunately i can press “like” only once…)

I did another LIKE click for ya :sunglasses:

1 Like

I “liked” it a second time for you ! But, who will do it for me know ? :wink:

I did it :wink: I’m having a good day. (Every day that brings us one step further to get a momentary button is a good day :sunglasses:)

I recently use a GP Script which increases widget values over time (to manipulate the filter cutoff while playing with both hands). For that I also use a “Reset” button that sets the filter cutoff to a default value. This button is supposed to be a momentary button too (I currently use the SetWidgetValue(0) method but I think it would be much better to have it as a widget option).

3 Likes

Care to share the idea :wink: thanks!

Hi All - quite a few people have mentioned it’s possible to get a momentary behaviour using scripts. As a total beginner here would anyone have an existing script they can copy and paste?

Also wondered if it’s possible to make a button that only be pressed once whilst the scene is loaded until it’s reloaded…i’m trying to use Gig Performer to send MIDI on a virtual MIDI port into Ableton to trigger clips etc

Thanks in advance, pete

Here you go:
Momentary.gig (6.5 KB)

Var
   MIN    : MidiInBlock
   BUTTON : Widget
   n : NoteMessage

initialization
 n := MakeNoteMessage(C3, 100)
end
   
on WidgetValueChanged (newValue : double) from BUTTON
 if newValue == 1.0 then
  ScheduleMidiEvent(MIN, n, 200)
 end 
end 

on NoteEvent (n : NoteMessage) from MIN
 SetWidgetValue(BUTTON,0.0)
end
1 Like

@Pete-Watson if you search the forum you get nice things around using LIVE with GP :wink:

1 Like

Ok, this is very interesting.

So, I have a meloaudio midi commander. It’s a great bit of hardware, but mostly it’s set up to control a variety of specific guitar rig software/hardware and so it’s unfortunately a bit mince at actually commanding midi…

I’m trying to get it to work with gig performer. Of the many stumbling blocks I’m hitting, most of which are the fault of the unit’s poor firmware, this is the most persistent. The unit can send a toggle cc or it can send an non toggled cc, but in the latter case it doesn’t send a 0 value on release, it just sends 127 every time you hit the button.

I can see that there isn’t a way built in, but could one script the control to reset itself a milisecond after being triggered by the footswitch? Specifically, I have a looper vst that requires it’s reset button to be run by a momentary command, and at the moment when I trigger it it stays jammed on and i have to switch the button to toggle mode in order to turn it off with another foot press.

It occurs to me that making any command momentary should be a matter of just telling the swtich to reset itself to zero after a short delay, no?

Hi @manhippo, welcome to the familiy.

Try this setting:

Thanks Paul.

Monetary to Latching? That’s the opposite of the bahaviour I want, I’m afraid. As mentioned above, it does turn my crunky monetary footswtich into a latching footswitch, but that still means that I have to press it once to activate the reset parameter on the looper and then press it again to turn off the button ready for the next reset.

However, after a few moments fiddling with your script I’ve managed to make it do what I want, namely reset the button after I press it automatically. Ace!

Seems like another option under the ‘momentary to latching’ one, allowing exactly the behaviour described above, would be an excellent addition to the software, allowiing for the use of pretty much any hardware in any context. In the meantime, thanks for the script. I still don’t really understand why it works (and the programming reference manual seems to be pretty threadbare) but work it does. Just had to figure out how to tag the relevant items in the script.

Seems like widget names have to be unique though, so I guess one has to run the script for every button that needs to have that behaviour?

Is there a way to run a script like that with a list of widgets it should apply to? Or is it a matter of compiling script on a widget by widget basis. If the latter, is there any appreciable cpu problem from adding those code snippets, or is it all so small as to not matter? I know using, say, max for live in live tends to introduce a disporportionate amount of cpu load. Reaktor has similar issues, just wondering if that’s likely to be the case here? My feeling is no, as the code isn’t doing any heavy lifiting audio processing, just turning a switch off?

No worries, this little scripts do not really stress the CPU.
And yes, you need a callback “on WidgetValueChanged” for each Widget you need such a function.

Thankyou Paul.

If i’m understanding the script right, I don’t actually need the note message bit as I’m not trying to trigger the command from a musical note? Is that correct?

Currently mys succesfully compiled hack of your script looks like this:

Var
midi : MidiInBlock
mom : Widget
n : NoteMessage

initialization
n := MakeNoteMessage(C3, 100)
end

on WidgetValueChanged (newValue : double) from mom
if newValue == 1.0 then
ScheduleMidiEvent(midi, n, 200)
end
end

on NoteEvent (n : NoteMessage) from midi
SetWidgetValue(mom,0.0)
end

Where ‘midi’ is the name of the midi in widget in my patch and ‘mom’ is tha name of the button I want to behave in a momentary fashion. I’d need to declare further buttons in the list at the top, and then duplicate the onwidgetvaluechanged paragraph for each button? Although I’m pretty sure I’m reading that wrong as the n function you define is called by said paragraph. Are you just using a midi note as an internal trigger within the script here?

Sorry to ask so many questions. The manual devoted to the scripting language seems to be awaiting completion, so not sure where else to find good info.

Tomorrow I can send you an example gig with some widgets.