How can I send an OSC message from shell?

2.2k views Asked by At

Is there any way to accomplish this? If so, I'd appreciate an example of some sort.

Thanks!

1

There are 1 answers

0
Charles Martin On

Here's a little Python script to send one OSC message at a time from a shell:

import OSC
import argparse

parser = argparse.ArgumentParser(description='Send an OSC Message.')
parser.add_argument('host',help='IP Address')
parser.add_argument('port',help='Port')
args = parser.parse_args()

ip_address = args.host
port = int(args.port)

msg = OSC.OSCMessage("/foo/bar")
msg.extend(['string argument',1,2,3.14])

oscClient = OSC.OSCClient()
oscClient.sendto(msg,(ip_address,port))

Suppose you saved the script as oscsender.py, then you would run it from a shell like this:

python oscsender.py 127.0.0.1 8000