forked from scheb/sound-to-light-osc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osc.py
23 lines (17 loc) · 737 Bytes
/
osc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pythonosc import udp_client
from pythonosc.udp_client import SimpleUDPClient
class OscClient:
osc_client: SimpleUDPClient
def __init__(self, server, port) -> None:
self.osc_client = udp_client.SimpleUDPClient(server, port)
def send_prog_signal(self, program):
# print("send program signal")
self.osc_client.send_message("/prog{:d}".format(program), 1.0)
def send_beat_signal(self):
# print("send beat signal")
self.osc_client.send_message("/beat", 1.0)
self.osc_client.send_message("/beat", 0.0)
def send_bar_signal(self):
# print("send bar signal")
self.osc_client.send_message("/bar", 1.0)
self.osc_client.send_message("/bar", 0.0)