» PythonToVVVV
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

PythonToVVVV

sending

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))

receiving

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

Shoutbox

~10h ago

Urbankind: circuitb:Wrongcop is epic! :)

~11h ago

joreg: @tobi: use GetSlice() as the patch i referred you to is demonstrating. or start a forum thread with your patch.

~11h ago

TobiTobsen123: hmm yes i can see the values...but how to handle them as seperate values? I need to forward them via TCP/IP...

~13h ago

joreg: @tobi: OSCDecoder helppatch has a section: OSC_Advanced (bottomright) that demoes decoding of multiple messages

~13h ago

TobiTobsen123: I'm using an OSCDecoder, it receives two arguments...works but how can I seperate the arguments into two seperate values

~16h ago

u7angel: @mediadog, make it a forum question.

~16h ago

u7angel: @mediadog, tty renderer ?

~18h ago

microdee: however non-conductive objects are invisible for this so the pencil and the sticks in the video are still a mysteries