Generally, you build an OSC message like this:
{CODE()}import socket
import OSC
ssend = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
message = OSC.OSCMessage()
message.setAddress("/test")
message.append(7)
message.append(3.1415)
message.append("everything you know is wrong!")
OSCdata = message.getBinary()
ssend.sendto(OSCdata,('localhost', 9000))
You can use the included CallbackManager class to handle bundles and call your functions based on their osc address.
{CODE()}import socket
import OSC
def printOSC(message):
print message
manager = OSC.CallbackManager()
manager.add(printOSC, "/test")
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind'localhost', 9000?
while 1:
data, rest = s.recvfrom(1024) manager.handle(data)
then, if the address of the incoming message matched the example callback, we would see ("/test", ",ffs", 7, 3.1415, "everything you know is wrong!",) printed out, because the argument to the callback function is a tuple of the decoded OSC message including the address and the typetag string.
Place attached OSC.py to lib in your python installation.
anonymous user login
~3h ago
~4h ago
~4h ago
~4h ago
~7h ago
~9h ago
~9h ago
~11h ago
~11h ago
~11h ago