Trigger Script Issue

I have the following local rackspace script I’ve been using to trigger a specific note from a hold pedal press. It ‘almost’ does what I’m wanting it to do, however I never want it to trigger for ANY reason other than I stepped on the pedal. Initially, the version I had trigger on entering (and sometimes leaving) the song in setlist view. If I switch from setlist view to rackspace view, it triggers every time. How do I get this thing to ONLY EVER trigger when I hit the pedal and for no other reason.

var
    LeftHold : Widget
    BottomKbdIn : MidiInBlock
    i : Boolean
// Called automatically after script is loaded
Initialization
    i = False
    
End




// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from LeftHold
        var n : NoteMessage
        var x : NoteMessage
        n = MakeNoteMessage(70, 127)
        x = MakeNoteMessage(70, 0)
        
        if(i == True)
        Then
        SendNow(BottomKbdIn, n)
        SendLater(BottomKbdIn, x, 100)
        Else
         i = True
        End
        
    
End

X

Why do you not use the newValue to decide if the pedal is used?
I assume the pedal is midi learned to the widget.

1 Like

First, make sure that the widget is confugured properly!
Means:

  • make it momentary
  • make sure that it doesn’t load its last state on gig start or activation, instead it should always start with 0 (=OFF)


2024-08-23 20_46_11-Untitled

Then change your script this way:

var
    LeftHold : Widget
    BottomKbdIn : MidiInBlock

//you can already define the note message in the variable block
// --> no need to search if you'd have to change it
    n : NoteMessage = MakeNoteMessage(70, 127)
    x : NoteMessage = MakeNoteMessage(70, 0)

// Called automatically after script is loaded
Initialization
//optional
//SetWidgetValue(LeftHold,0)
End

// Called when rackspace is activated
On Activate
//optional
//SetWidgetValue(LeftHold,0)
End

// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from LeftHold
    if newValue == 1.0 then
        SendNow(BottomKbdIn, n)
        SendLater(BottomKbdIn, x, 100)
    end
End

As PianoPaul already mentioned, the widget exposes a value when its state changes (newValue), this value will be 1.0 when the widgets goes ON, or it will be 0 when the widget goes off.
So no need to juggle with booleans and stuff - the situation is always clear and defined.

Yes, the pedal is midi-learned through rig manager. I think Schamass may have the correct answer . I’m trying it out shortly.

1 Like

First there are probably other way to do this even without a GPScript:

Getting back to your local GPScript, I don’t like the fact that you don’t take into account the actual state of your controller (newValue), but another Boolean variable (i). You could make this work by setting i=True in the initialization and the On Activate callback, but this is the kind of source of confusion that leads to the kind of weird behavior you are faced to.

With the widget settings proposed by @Schamass (you could additionally use ignore variation), the callback could something like that (I didn’t test) :

On WidgetValueChanged(newValue : double) from LeftHold  
  SendNow(BottomKbdIn, MakeNoteMessage(70, newValue*127))      
End

But again, no GPScript is necessary for that or perhaps I missed something. :wink:

I want to thank all of you for your help. I don’t know how I missed that you could send note on values to a midi in block from a widget without scripting. This changes everything :slight_smile:

X

3 Likes