hugvey/pd/sendOSCMsg.py

33 lines
887 B
Python
Raw Normal View History

2019-05-10 12:53:02 +00:00
"""Small example OSC client
This program sends 10 random values between 0.0 and 1.0 to the /filter address,
waiting for 1 seconds between each value.
"""
import argparse
import random
import time
from pythonosc import osc_message_builder
from pythonosc import udp_client
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="127.0.0.1",
help="The ip of the OSC server")
parser.add_argument("--port", type=int, default=5555,
help="The port the OSC server is listening on")
args = parser.parse_args()
client = udp_client.SimpleUDPClient(args.ip, args.port)
while(1):
print("sending start to {0} on port {1}".format(args.ip, args.port))
client.send_message("/trigger", 1)
time.sleep(2)
2019-05-10 13:03:41 +00:00
print("sending stop to {0} on port {1}".format(args.ip, args.port))
2019-05-10 12:53:02 +00:00
client.send_message("/trigger", 0)
time.sleep(2)