Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit db76221

Browse files
committed
bela osc basic example complete
1 parent 38ca0f1 commit db76221

File tree

2 files changed

+18
-98
lines changed

2 files changed

+18
-98
lines changed

examples/bela/osc-basic/render.cpp

Lines changed: 0 additions & 92 deletions
This file was deleted.

examples/bela/osc-basic/server.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
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+
820
from iipyper import OSC, run, repeat
921

1022
def 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

Comments
 (0)