Last active
September 10, 2025 19:59
simple samples for testing OSC Type Tag "T", "F", and "N" with python-osc
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # | |
| # client side test for OSC Type Tag "T", "F", and "N" with python-osc | |
| # | |
| # see also: https://github.com/attwad/python-osc | |
| from pythonosc import udp_client | |
| import time | |
| ip = "localhost" # change this line appropriately | |
| port = 9002 # change this line appropriately | |
| osc_client = udp_client.SimpleUDPClient(ip, port) | |
| i = 0 | |
| while True: | |
| i = i + 1 | |
| osc_client.send_message("/test", [True]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [False]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [None]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [True, False, None]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", ["aaa" + str(i), True]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [1, 2, 3, True]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [True, 4, 5, 6]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [7, 8, 9, None]) ; time.sleep(0.04) | |
| osc_client.send_message("/test", [None, 10, 11, 12]) ; time.sleep(0.04) | |
| time.sleep(1) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # | |
| # client side test for OSC Type Tag "T", "F", and "N" with python-osc | |
| # | |
| # see also: https://github.com/attwad/python-osc | |
| from pythonosc import dispatcher | |
| from pythonosc import osc_server | |
| def print_osc(addr, *args): | |
| print(f"addr: {addr} -- args: {args}") | |
| ip = "localhost" # change this line appropriately | |
| port = 9003 # change this line appropriately | |
| dispatcher = dispatcher.Dispatcher() | |
| dispatcher.map("/*", print_osc) | |
| server = osc_server.ThreadingOSCUDPServer((ip, port), dispatcher) | |
| print("Serving on {}".format(server.server_address)) | |
| server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the issue I opened for osc-ruby is here: aberant/osc-ruby#21