fbpx

Invoking GP Script functions from Timeline Actions

Sep 4, 2023 | Gig Performer Blog, GP Script, OSC

In this blog article, you will learn how to Invoke GP Script functions from Timeline Actions.

Gig Performer 4.7, released recently, includes a new Streaming Audio File Player that supports timelines and actions. That means that you can play a backing track and have “things” (aka actions) happen automatically as a song plays. Typical actions include the ability to switch rackspaces or songs, send out program changes or arbitrary MIDI messages, and change widget values. You can find more information about the timeline and supported actions in the online user manual.

OSC Actions

.
One of the actions supported by the new timeline is the ability to send out OSC messages with arguments. For example, you may use this action

to send a message to some application controlling lights and set the intensity of a red light to 50%. You can also use OSC messages to control tablet apps such as TouchOSC or Lemur.

GP Script

.
GP Script is Gig Performer’s proprietary programming language intended for both novices and experienced developers to implement functionality that is not already built into Gig Performer itself. The GP Script language supports an easy to use callback mechanism allowing it to respond to such things as incoming MIDI messages, widget value changes and plugin parameter changes.

GP Script can also respond to incoming OSC messages. Consider the following callback defined in the Global Rackspace script.

On OSCMessageReceived(m : OSCMessage) Matching /AddNumbers
Var
   first, second : integer

   If m.OSC_ArgCount() == 2 // Make sure there are two parameters
      Then 
         first = m.OSC_GetArgAsInteger(0) // Get the first value
         second = m.OSC_GetArgAsInteger(1) // Get the second value
       
         // Now add them together and display the result
         DisplayTemporaryMessage("The sum is " + (first + second))
   End         
End

This OSC callback will be triggered if an OSC message with the address /AddNumbers is received. It will then check to see that there are two arguments and if so it will retrieve them, add them together and display the result in Gig Performer’s display area at the top of the main window.

Now take a look at this action:

This action sends out an OSC message with the address /AddNumbers and two integer arguments. When the action is triggered, the GP Script callback will be invoked and the result of the calculation will be displayed in Gig Performer

Conclusion

.
Apart from creating your own user functions, GP Script has a system library with several hundred library functions that not only allow considerable control over Gig Performer and even other applications through the shell system functions.

OSC actions can therefore cause GP Script with essentially arbitrary commands create almost arbitrary functionality with GP Script.

If you have any questions or feedback, share them with us in this community thread.