» 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

~3h ago

christosk: Thanx Elliot! UnixPath worked fine :-)

~4h ago

elliotwoods: or 'unix path' (for forward slash). also custom deliminators are accepted on other pins

~4h ago

elliotwoods: @christosk : check for 'dos path'

~4h ago

christosk: What's the node to use in order to separate elements inside a string by using slashes? Separate doesn't give a Slash enumeration.

~7h ago

metrowave: vvvv not loading, it says 'no DLLs were found in the waterfall procedure' to do with error at loading ippSP library. any ideas?

~9h ago

fjen: Kaiser #BYOB this saturday ... check forum for details

~9h ago

catweasel: is there a max number of audio outs? I seem to have found one...

~11h ago

manuel: @cat thats quite a lot of money. im intereseted in the automatic calibration

~11h ago

manuel: I remember had a problem with framebuf on b25, but didn't find the forum thread about it.

~11h ago

u7angel: @mediadog, framebuf works with 27.2. i just tried it. no idea whats your problem with it.