File: osc-format-parse-help.pd

package info (click to toggle)
puredata 0.55.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 20,508 kB
  • sloc: ansic: 118,824; tcl: 10,221; cpp: 9,327; makefile: 1,632; sh: 1,476; python: 152; xml: 98; awk: 13
file content (154 lines) | stat: -rw-r--r-- 7,755 bytes parent folder | download | duplicates (4)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#N canvas 396 59 893 650 12;
#X msg 292 171 1 2 3;
#X obj 577 271 oscparse;
#X obj 26 418 oscparse;
#X text 426 256 creation arguments are OSC address, f 18;
#X msg 322 348 disconnect;
#X obj 292 377 netsend -u -b;
#X msg 309 322 connect localhost 5000;
#X text 13 616 see also:;
#X obj 234 617 list;
#X obj 174 617 netsend;
#X msg 49 252 format;
#X text 100 252 no format;
#X text 120 274 a 'blob';
#X obj 29 10 oscformat;
#X text 101 9 - convert lists to OSC packets;
#X listbox 577 332 13 0 0 0 - - - 0;
#X listbox 26 446 28 0 0 0 - - - 0;
#X obj 91 617 fudiformat;
#X obj 36 34 oscparse;
#X text 101 35 - parse OSC packets into Pd messages;
#N canvas 723 31 546 618 reference 0;
#X obj 8 52 cnv 5 500 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 8 151 cnv 2 500 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 8 188 cnv 2 500 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 7 284 cnv 5 500 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 7 368 cnv 5 500 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 6 583 cnv 5 500 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 28 19 oscformat;
#X obj 28 337 oscparse;
#X text 116 66 list - list to format into a OSC packet.;
#X text 74 86 set <list> - set one or more addresses.;
#X text 138 253 1) list - list of one or more addresses;
#X text 95 382 list - OSC packet to convert to Pd list messages.;
#X text 39 109 format <symbol> -;
#X text 164 109 characters set format types: 'b' (blob) \, 'i' (integer) \, 'f' (float) or 's' (string)., f 43;
#X text 99 218 -f <symbol>: sets format as in the 'format' message;
#X obj 9 212 cnv 1 500 1 empty empty flag: 8 12 0 13 #7c7c7c #000000 0;
#X obj 9 243 cnv 1 500 1 empty empty args: 8 12 0 13 #7c7c7c #000000 0;
#X obj 8 549 cnv 2 500 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X text 116 161 list - converted OSC packet from lists.;
#X text 103 18 - convert lsts to OSC packets.;
#X text 93 337 - parse OSC packets into Pd list messages.;
#X text 180 560 NONE;
#X obj 9 512 cnv 1 500 1 empty empty flag: 8 12 0 13 #7c7c7c #000000 0;
#X text 112 520 -n: interpret floats in addresses as floats.;
#X obj 6 471 cnv 1 500 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 6 442 cnv 1 500 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X obj 7 413 cnv 2 500 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X text 125 448 list - OSC packets with address and message.;
#X text 118 480 float - split point for address and message.;
#X restore 701 30 pd reference;
#X text 795 30 <= click;
#X obj 7 64 cnv 1 880 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 6 602 cnv 1 880 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 577 209 netreceive -u -b 5000;
#X obj 309 298 loadbang;
#X text 395 378 send as UDP \, binary;
#X msg 56 274 format b;
#X msg 62 296 format fib;
#N canvas 647 325 656 196 more-about-OSC 0;
#X text 29 41 OSC is a complicated networking protocol (FUDI \, as used in [netsend] and [netreceive] is simpler and better but less widely used). The [oscparse] and [oscformat] objects make no attempt to deal with timetags or aggregates of packets \, nor with streaming OSC. Also \, no attempt is made to clearly distinguish between blobs and lists of numbers - it is assumed that you know what types the message should contain. You can alternatively use the OSC externals \, such as from the "mrpeach" or "else" library \, which offer more features and conveniences than these., f 85;
#X restore 741 559 pd more-about-OSC;
#X text 663 616 updated for Pd version 0.55-0;
#X floatatom 777 273 4 0 0 0 - - - 0;
#X obj 577 302 list split, f 29;
#X listbox 677 332 15 0 0 0 - - - 0;
#X text 750 250 split point;
#X text 734 201 receive OSC via UDP \, binary at port 5000, f 20;
#N canvas 590 199 628 392 -n 0;
#X msg 85 78 1 2 3;
#X msg 90 283 disconnect;
#X obj 60 319 netsend -u -b;
#X obj 77 227 loadbang;
#X obj 332 148 netreceive -u -b 5005;
#X msg 77 251 connect localhost 5005;
#X obj 60 175 oscformat 1;
#X obj 332 200 oscparse -n;
#X obj 332 243 route 1 2;
#X listbox 362 282 12 0 0 0 - - - 0;
#X msg 109 138 set 2;
#X msg 99 114 set 1;
#X msg 60 45 4 5 horse 6;
#X listbox 332 319 12 0 0 0 - - - 0;
#X text 230 34 [oscparse] outputs addresses as symbols even if they look like floats. Nonetheless \, you probably want them to be interpreted as floats \, but you need to use the '-n' flag for that. This way you can also use [route] to route the message according to the float address., f 51;
#X floatatom 429 198 3 0 0 0 - - - 0;
#X connect 0 0 6 0;
#X connect 1 0 2 0;
#X connect 3 0 5 0;
#X connect 4 0 7 0;
#X connect 5 0 2 0;
#X connect 6 0 2 0;
#X connect 7 0 8 0;
#X connect 7 1 15 0;
#X connect 8 0 13 0;
#X connect 8 1 9 0;
#X connect 10 0 6 0;
#X connect 11 0 6 0;
#X connect 12 0 6 0;
#X restore 706 380 pd -n flag;
#X obj 26 473 list trim;
#X text 592 369 get addresses as numbers --->, f 15;
#X listbox 26 563 18 0 0 0 - - - 0;
#X obj 26 528 route cat;
#X text 102 510 nested routing, f 7;
#X text 139 296 float \, int \, blob;
#X msg 26 199 5.5 6 7 squirrel;
#X msg 68 318 format iiisii;
#X text 165 319 ints and symbol;
#X text 17 75 [oscformat] takes lists and makes OSC (Open Sound Control) packets (byte by byte) suitable for sending over the network via [netsend] (in UDP binary mode). The OSC address (the strings between the slashes) are given by arguments or by "set" messages., f 122;
#X text 189 350 a blob by default, f 9;
#X text 429 207 a 'set' message changes address, f 15;
#X text 451 116 [oscparse] takes lists of numbers as bytes in an OSC message and outputs a list containing the address and numbers and symbols as present in the OSC message. A right outlet outputs the the split point between address and message \, but one can also use [route] to route addresses.;
#X msg 277 147 list weasel 6 7 rat;
#X text 294 119 OSC messages:;
#X text 18 122 OSC messages only contain 'float' and 'symbol' (string) data types \, except if you specify the format as shown below., f 33;
#X obj 43 386 print OSC-packet-1;
#X obj 590 239 print OSC-packet-2;
#X text 257 418 If a format is given (via the '-f' flag or 'format' message) [oscformat] can interpret incoming data as integers (i) \, floats (f) \, strings (s) or 'blob' (b). If the elements aren't exhausted at the end of the format string \, the default (float and symbol) conversions are made for the rest. Blobs are lists of bytes that start with an atom count followed by that number of elements (if an element is a symbol \, its first byte is sent). If the count is negative \, the entire remaining message is included in the blob (but the OSC parser will report the actual number of elements)., f 86;
#X text 257 524 Note: [oscparse] can't distinguish floats from ints \, nor to see blobs unambiguously. If [oscparse] receives a bundled message it simply parses all the messages in the bundle in the order they appear \, and ignores the bundle's time tag., f 86;
#X obj 26 357 oscformat -f b dog cat;
#X obj 26 504 route dog;
#X msg 308 228 set mouse ferret;
#X msg 303 204 set wombat horse;
#X obj 292 262 oscformat pig mule;
#X msg 35 222 -1.1 1 2 donkey 4 5;
#X connect 0 0 61 0;
#X connect 1 0 32 0;
#X connect 1 1 31 0;
#X connect 2 0 16 0;
#X connect 4 0 5 0;
#X connect 6 0 5 0;
#X connect 10 0 57 0;
#X connect 16 0 37 0;
#X connect 24 0 1 0;
#X connect 24 0 54 0;
#X connect 25 0 6 0;
#X connect 27 0 57 0;
#X connect 28 0 57 0;
#X connect 31 0 32 1;
#X connect 32 0 15 0;
#X connect 32 1 33 0;
#X connect 37 0 58 0;
#X connect 40 0 39 0;
#X connect 43 0 57 0;
#X connect 44 0 57 0;
#X connect 50 0 61 0;
#X connect 57 0 2 0;
#X connect 57 0 53 0;
#X connect 58 0 40 0;
#X connect 59 0 61 0;
#X connect 60 0 61 0;
#X connect 61 0 5 0;
#X connect 62 0 57 0;