Sending OSC messages from Pythonista with pyOSC: http://bit.ly/1Vl8PCN
#!/usr/bin/env python | |
# Get pyOSC here: https://trac.v2.nl/wiki/pyOSC | |
# The GitHub-hosted version of pyOSC is for Python 3 which isn't supported by Pythonista at the moment | |
from OSC import OSCClient, OSCMessage | |
client = OSCClient() | |
client.connect(("192.168.43.120", 8000)) | |
msg = OSCMessage("/msg/notes") | |
msg.append([50, 60]) | |
client.send(msg) | |
msg.clearData(); | |
msg.append(["C3", 127]) | |
client.send(msg) | |
client.send(OSCMessage("/quit")) |
#!/usr/bin/env python | |
# Get pyOSC here: https://trac.v2.nl/wiki/pyOSC | |
# The GitHub-hosted version of pyOSC is for Python 3 which isn't supported by Pythonista at the moment | |
from OSC import OSCServer | |
server = OSCServer(("192.168.43.120", 8000)) | |
server.timeout = 0 | |
print "OSC Sever started. Press Ctrl-C to stop." | |
def handler(addr, tags, data, client_address): | |
s = "Message '%s' from %s: " % (addr, client_address) + str(data) | |
print s | |
def quit_handler(addr, tags, data, client_address): | |
print "OSC Server quit." | |
server.close() | |
server.addMsgHandler('/msg/notes', handler) | |
server.addMsgHandler('/quit', quit_handler) | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment