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

Commit f5ee27f

Browse files
authored
Merge pull request #7 from Intelligent-Instruments-Lab/ja-dev
Max examples
2 parents d6cf92c + f024fa3 commit f5ee27f

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Authors:
3+
Victor Shepardson
4+
Jack Armitage
5+
Intelligent Instruments Lab 2022
6+
"""
7+
8+
"""
9+
This example corresponds to the help file for CNMAT's OpenSoundControl Max object.
10+
"""
11+
12+
from iipyper import OSC, run, repeat
13+
14+
def main(port=7005):
15+
16+
osc = OSC(port=port)
17+
osc.create_client("max", port=5432)
18+
19+
count = 0
20+
21+
@osc.args("/*")
22+
def _(address, *args):
23+
"""
24+
Handle OSC messages from Max
25+
"""
26+
print(f"{address} {args}")
27+
28+
@repeat(1)
29+
def _():
30+
nonlocal count
31+
osc("max", "/test", count)
32+
count = count + 1
33+
34+
if __name__=='__main__':
35+
run(main)

examples/max/readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `iipyper` Max/MSP examples
2+
3+
Documentation:
4+
- https://cycling74.com/articles/cnmat-odot-tools-for-osc-and-beyond
5+
6+
## Examples
7+
- `OpenSoundControl`: example corresponding to the help file for CNMAT's OpenSoundControl object
8+
- `udp`: example corresponding to the Max help files for `updsend` and `udpreceive`
9+
- `notepredictor`
10+
+ how does the `return` result in `osc.send`?
11+
+ why do the SC examples not load a model?

examples/max/udp/server.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
Authors:
3+
Victor Shepardson
4+
Jack Armitage
5+
Intelligent Instruments Lab 2022
6+
"""
7+
8+
"""
9+
This example corresponds to the help file for the `updsend` and `updreceive` Max objects.
10+
In the Max help file, make sure the `updreceive` object's port is set to 7401.
11+
"""
12+
13+
from iipyper import OSC, run, repeat
14+
15+
def main(port=7400):
16+
17+
osc = OSC(port=port)
18+
osc.create_client("max", port=7401)
19+
20+
count = 0
21+
22+
@osc.args("/*")
23+
def _(address, *args):
24+
"""
25+
Handle OSC messages from Max
26+
"""
27+
print(f"{address} {args}")
28+
29+
@repeat(1)
30+
def _():
31+
nonlocal count
32+
osc("max", "/test", count)
33+
count = count + 1
34+
35+
if __name__=='__main__':
36+
run(main)

0 commit comments

Comments
 (0)