forked from ryokomy/python2-osc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_client.py
More file actions
29 lines (23 loc) · 807 Bytes
/
simple_client.py
File metadata and controls
29 lines (23 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""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=8000,
help="The port the OSC server is listening on")
args = parser.parse_args()
client = udp_client.UDPClient(args.ip, args.port)
for x in range(10):
msg = osc_message_builder.OscMessageBuilder(address = "/filter")
msg.add_arg(random.random())
msg = msg.build()
client.send(msg)
time.sleep(1)