Created
June 19, 2020 17:21
-
-
Save shks/711411b5ea6151c099d7ca29ff901a29 to your computer and use it in GitHub Desktop.
Touchdesigner - python communication via OSC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python | |
''' | |
setup instruction | |
for Install pythonosc | |
pip install python-osc | |
''' | |
from pythonosc import dispatcher | |
from pythonosc import osc_server | |
from pythonosc import udp_client | |
def messege_handler(unused_addr, *p): | |
try: | |
print(p) | |
client.send_message("/message_echo", p) | |
except ValueError: pass | |
dispatcher = dispatcher.Dispatcher() | |
dispatcher.map("/message", messege_handler) | |
server = osc_server.ThreadingOSCUDPServer(("127.0.0.1", 5005), dispatcher) | |
print("Serving on {}".format(server.server_address)) | |
client = udp_client.SimpleUDPClient("127.0.0.1", 5006) | |
server.serve_forever() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = op('oscout1') | |
n.sendOSC('/message',['something', 9999]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment