top of page

OSC Global Remote TouchDesigner

This tool allows for easy control of custom parameters in TouchDesigner via OSC using the global OP shortcut. Here’s an example: Somewhere in your show file, there’s a Base or Container with a "Global OP Shortcut." In this case, let's say the shortcut is named "para1".


This Base or Container has custom parameters. "Gain", "Colorr", ......

Now, you can simply add the OSC GlobalRemote anywhere in your file.

Now, you have up to 10 OSC In DATs, all sharing the same callback:

 

def onReceiveOSC(dat, rowIndex, message, bytes, timeStamp, address, args):

tableDAT = op('table1') # Reference to the Table DAT

# Extract OSC path and value

path = address # Example: "/Input/OK"

value = float(args[0]) # Convert incoming OSC value


# Remove the first "/" from the OSC path

if path.startswith("/"):

path = path[1:]


# Check if the OSC path already exists in the Table DAT (in the first column)

row_found = False

for row in tableDAT.rows():

if row[0].val == path:

# Update the value in the second column

row[1].val = value

row_found = True

break


if not row_found:

# Add a new row with the OSC path and value if not found

tableDAT.appendRow([path, value])


 

This will convert the incoming OSC data to a table and then into a CHOP.

By using a CHOP Execute, we can now control parameters using the following OSC format:

 

/GlobalOPShortcut/Parameter

For example:

OSC: /para1/Gain
OSC: /para1/Gain
 

chopexec1:


def onValueChange(channel, sampleIndex, val, prev):

# Get the channel name

channel_name = channel.name # Example: 'para1/Gain'

# Split the channel name into operator and parameter parts

operator_name, param_name = channel_name.split('/')

# Dynamically access the operator using global shortcut

try:

operator = getattr(op, operator_name)

# Check if the operator exists

if operator is None:

print(f"OSC Globalremote Error: Operator '{operator_name}' not found!")

return

# Check if the parameter exists using direct access

if hasattr(operator.par, param_name):

# Set the parameter's value to the channel value

operator.par[param_name] = val

else:

print(f"OSC Globalremote Error: Parameter '{param_name}' does not exist in operator '{operator_name}'")

except AttributeError:

print(f"OSC Globalremote Error: Global shortcut '{operator_name}' not found.")

return

 

I use this tool in combination with TouchOSC and need feedback when a parameter in TouchDesigner changes, sending updates back to TouchOSC.

For this, the OSC_GlobalFeedback is used.


This Base must always be placed inside the object. In this example, it should be inside "Parameter1", as it references the parameter one level above using "../..".



 

Cheers :)




Comments


  • Instagram
bottom of page