OSC control of MOTU interfaces from GP

Greetings,
Apologies in advance for the length of this post.
Desired outcome:
Use GP widgets to control MOTU interface mixer functions; specific focus on faders for MOTU mixer Auxes but also channel faders and Mutes.
Useful info/links:

  1. MOTU provides OSC access to control many functions as documented here MOTU OSC Reference Doc.
  2. The GP documentation on OSC and scripting is very good but I am arguably the least qualified person here to try to write scripting because I am just not internally wired for it. Therefore I loaded as much relevant documentation as I could into Google’s NotebookLM; which is how I have generated my scripts that so far don’t quite work (pasted in further down this post). Google NotebookLM
  3. I did scour the various community posts on all things OSC and while I am comfortable that I can configure the basic OSC connections and connect widgets to them, the scripting is where it all goes off the cliff for me.
  4. I am able to confirm that I have network/OSC connectivity from my Mac running GP to my MOTU 828es interface as I was able to get a slider to move in one direction at one point.
  5. I am thinking that I need to configure/define the MOTU in the Rackspace script and then use Scriptlets to feed the widgets but I am more than happy to be corrected if I am wrong here.
    I feel confident that this can be made to work with some help from the smart folks in this community and once it is working I am more than happy to share the results if anyone else is interested.
    Code so far:
//Var
// MOTU_OSC_Target_Name : String = "MOTU_828es" // <<< CONFIGURE THIS
// MOTU828es : Widget

// This script controls a MOTU mixer channel's auxiliary send level via OSC
// using a Gig Performer slider widget.

// *** IMPORTANT CONFIGURATION ***
// 1. Configure an OSC Target in Gig Performer's OSC settings.
//    Assign an IP address and Port that corresponds to your MOTU AVB Interface [3].
//    Give this target a name (e.g., "MOTU_MIXER").
// 2. Replace "MOTU_MIXER" below with the exact name you used for your OSC Target.
// 3. Create a slider widget on your Gig Performer panel.
// 4. Replace "MyAuxSendSlider" below with the exact GPScript Name of your slider widget.
//    (You can find/set this name in the Wiring view by selecting the widget) [43].
// 5. Determine the correct <index> values for your specific MOTU mixer channel and auxiliary send.
//    These indices are part of the OSC address path [2].
//    Replace the example TargetChannelIndex and TargetAuxIndex values below.
//    Note: Indexing is often 0-based (e.g., 0 for the first channel/aux).
//    Consult your specific MOTU documentation if unsure.

Var
  MOTU_OSC_Target_Name : String = "MOTU828es" // <<< CONFIGURE THIS
  TargetChannelIndex : Integer = 0 // <<< CONFIGURE THIS (e.g., 0 for channel 1)
  TargetAuxIndex : Integer = 5 // <<< CONFIGURE THIS (e.g., 0 for Aux 1)
  MOTU828es : Widget
  
// This callback function is triggered whenever the value of the widget named "MyAuxSendSlider" changes [42, 43]
On WidgetValueChanged(newValue : double) from MOTU828es

  // The widget's value is typically between 0.0 and 1.0 [42].
  // The MOTU aux send parameter expects a value between 0.0 and 4.0 (linear) [2].
  // Scale the widget's value to the target range.
  Var
    scaledValue : double = newValue * 4.0

  // Construct the OSC address path using the target channel and aux indices [2].
  Var
    oscAddress : String = "mix/chan/" + TargetChannelIndex + "/matrix/aux/" + TargetAuxIndex + "/send"

  // Check if the OSC target exists and OSC is enabled before sending (optional but good practice) [1].
  // if OSC_TargetNameExists(MOTU_OSC_Target_Name) AND OSC_Enabled() then

    // Send the scaled value as a double-precision floating-point OSC message [1].
    OSC_SendDouble(MOTU_OSC_Target_Name, oscAddress, scaledValue)

    // Optional: Display the sent OSC message and value in the scriptlet's display area for debugging [44, 45].
    // SetDisplayMessage("Sent OSC: " + oscAddress + " value: " + scaledValue)

  // end
End

This is in the Current Rackspace Script as it wouldn’t work in a Scriptlet as written. Compiler gives me this error: “Rackspace (Script Entity: Rackspace) - Semantic error in “Main”: Line 46, Col 42: Incompatible types” which refers to this section near the end of the script:

 // Send the scaled value as a double-precision floating-point OSC message [1].
    OSC_SendDouble(MOTU_OSC_Target_Name, oscAddress, scaledValue)

Grateful for any help that folks can provide. Happy to provide any additional details/clarifications as well.

Try:

    OSC_SendDouble(MOTU_OSC_Target_Name, scaledValue)

SendDouble doesn’t take an address parameter, the address is retrieved from the OSC target configuration. You should have an entry configured for moto828es in the target configuration page that has the address and port needed for your interface.

One key point to the MOTU OSC implementation is you can only write values, not read. So you will need to start with some sane values because you won’t be able to read the current value from the MOTU. I have a Ultralite AVB I setup a few years ago and used OSC to control the MOTU volume from Roon. If you really need to read the state at startup then you will have to use the HTTP interface, which I don’t think GPScript has an easy way to do.

I think you’re close, which is remarkable for AI generated code. Good thing I’m about to retire from making my living in the software industry… :wink:

1 Like

Thanks @menlobob. I’ll try this later today.
As a newly retired software product manager, I feel ya on the AI bit.

Your suggestion @menlobob did indeed resolve the compilation error. Thanks again. I have some other bits to sort out to get this working but hope springs eternal.

After spending some more time digging into this, I became enlightened via some RTFM that the direct OSC in the widgets actually gives me what I am looking for without scripting at all. Happy days!

1 Like