55 Intelligent Instruments Lab 2022
66"""
77
8+ """
9+ To run this example, open the Bela OSC example at:
10+ https://github.com/BelaPlatform/Bela/blob/master/examples/Communication/OSC/render.cpp
11+
12+ And replace the ports and IP with the following:
13+ ```
14+ int localPort = 8888;
15+ int remotePort = 9999;
16+ const char* remoteIp = "192.168.7.1";
17+ ```
18+ """
19+
820from iipyper import OSC , run , repeat
921
1022def main (host = "192.168.7.1" , port = 9999 ):
@@ -15,12 +27,12 @@ def main(host="192.168.7.1", port=9999):
1527 connected = False
1628 count = 0
1729
18- @osc .kwargs ("/*" )
19- def _ (address , ** kw ):
30+ @osc .args ("/*" )
31+ def _ (address , * args ):
2032 """
2133 Handle OSC messages from Bela
2234 """
23- print (f"{ address } { kw } " )
35+ print (f"{ address } { args } " )
2436
2537 if address == "/osc-setup" :
2638 nonlocal connected
@@ -29,17 +41,17 @@ def _(address, **kw):
2941 osc ("bela" , "/osc-setup-reply" )
3042
3143 elif address == "/osc-acknowledge" :
32- print (f"Bela acknowledged osc-test: { kw } " )
44+ print (f"Bela acknowledged osc-test: { args } " )
3345
3446 else :
35- print (f"Unrecognised OSC { address } with { kw } " )
47+ print (f"Unrecognised OSC { address } with { args } " )
3648
3749 @repeat (1 )
3850 def _ ():
3951 nonlocal connected
4052 nonlocal count
4153 if connected == True :
42- osc ("bela" , "/osc-test" , count )
54+ osc ("bela" , "/osc-test" , count , 3.14 )
4355 count = count + 1
4456 else :
4557 print ("Waiting for Bela to connect..." )
0 commit comments