aboutsummaryrefslogtreecommitdiff
path: root/examples/lexpr-help.pd
blob: 3f2978a397f77aa6df2556e33d8dfe4f30025dcc (plain)
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
#N canvas 0 22 936 656 10;
#X floatatom 110 102 5 0 0 0 - - -;
#X floatatom 110 56 5 0 0 0 - - -;
#X floatatom 202 56 5 0 0 0 - - -;
#X floatatom 294 57 5 0 0 0 - - -;
#X obj 72 53 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 26 232 5 0 0 0 - - -;
#X floatatom 205 236 5 0 0 0 - - -;
#X floatatom 385 235 5 0 0 0 - - -;
#X floatatom 26 278 5 0 0 0 - - -;
#X obj 26 255 lexpr phi rho gamma -> 100*cos(phi) + gamma*sin(rho)
;
#X msg 115 205 lexpr foo bar baz -> foo * bar / baz;
#X msg 115 181 lexpr x y z -> x+y+z;
#X text 12 11 First come variable names \, then -> surrounded by spaces
\, then an expression (in Lua syntax).;
#X obj 110 77 lexpr a b c -> min(a \, b \, c);
#X text 14 122 Messages can change the expression (provided inlet count
stays the same). This resets the state of all variables. Note: weird
tricks are needed for commas in messages :(;
#X obj 86 441 lexpr a b c -> a + b + c;
#X msg 190 412 hot \$1;
#X obj 190 392 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 270 412 hot \$1;
#X obj 270 392 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 110 412 hot \$1;
#X obj 110 392 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X floatatom 86 367 5 0 0 0 - - -;
#X floatatom 167 367 5 0 0 0 - - -;
#X floatatom 249 367 5 0 0 0 - - -;
#X obj 68 387 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 86 469 5 0 0 0 - - -;
#X text 13 305 Eaxh inlet supports a "hot <float>" method \, that makes
the inlet hot or not. By default only the first inlet is hot. Sending
a bang to the first inlet always performs the calculation \, no matter
if that inlet is set to be cold.;
#X text 22 491 Multiple outlets are supported \, with multiple expressions
separated by commas.;
#X obj 82 546 lexpr a b -> a + b \, a - b;
#X floatatom 82 528 5 0 0 0 - - -;
#X floatatom 252 528 5 0 0 0 - - -;
#X floatatom 82 568 5 0 0 0 - - -;
#X floatatom 252 568 5 0 0 0 - - -;
#N canvas 2 22 450 300 \$0-weird-tricks-to-get-commas-in-messages 0
;
#X obj 58 231 lexpr a b -> max(a \, b) \, min(a \, b);
#X floatatom 32 194 5 0 0 0 - - -;
#X floatatom 33 273 5 0 0 0 - - -;
#X floatatom 284 198 5 0 0 0 - - -;
#X floatatom 284 275 5 0 0 0 - - -;
#X obj 123 148 makefilename %c;
#X msg 123 128 44;
#X obj 123 68 makefilename %c;
#X msg 123 48 44;
#X msg 123 88 lexpr a b -> min(a \$1 b) \$1 max(a \$1 b);
#X msg 123 168 lexpr a b -> max(a \$1 b) \$1 min(a \$1 b);
#X text 28 18 This is really ugly \, but it seems to work...;
#X connect 0 0 2 0;
#X connect 0 1 4 0;
#X connect 1 0 0 0;
#X connect 3 0 0 1;
#X connect 5 0 10 0;
#X connect 6 0 5 0;
#X connect 7 0 9 0;
#X connect 8 0 7 0;
#X connect 9 0 0 0;
#X connect 10 0 0 0;
#X restore 27 606 pd \$0-weird-tricks-to-get-commas-in-messages;
#X text 502 5 New in pdlua-0.5: interaction with Pd [value] objects.
;
#X obj 608 70 value \$0-foo;
#X floatatom 608 45 5 0 0 0 - - -;
#X obj 528 97 lexpr x y -> val("\$0-foo") * x / y;
#X floatatom 528 72 5 0 0 0 - - -;
#X floatatom 763 72 5 0 0 0 - - -;
#X floatatom 528 129 5 0 0 0 - - -;
#X text 504 161 Trying to access a [value] that doesn't exist returns
0:;
#X obj 539 224 lexpr z -> z + val("\$0-bar");
#X floatatom 539 202 5 0 0 0 - - -;
#X floatatom 539 253 5 0 0 0 - - -;
#X obj 508 384 lexpr scale name -> scale * val(name);
#X obj 782 319 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 672 343 symbol \$0-foo;
#X obj 672 319 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 782 343 symbol \$0-baz;
#X floatatom 792 377 5 0 0 0 - - -;
#X obj 792 399 value \$0-baz;
#X floatatom 508 354 5 0 0 0 - - -;
#X floatatom 508 415 5 0 0 0 - - -;
#X text 505 292 New in lexpr for pdlua-0.5: inputs can be symbols.
;
#X obj 511 531 lexpr left right -> "" .. left .. right;
#X symbolatom 511 497 10 0 0 0 - - -;
#X symbolatom 781 497 10 0 0 0 - - -;
#X symbolatom 511 570 0 0 0 0 - - -;
#X text 501 471;
#X text 494 446 New in lexpr for pdlua-0.5: outputs can be symbols
too. The inital "" is to make sure that we have a string.;
#X floatatom 737 496 5 0 0 0 - - -;
#X floatatom 594 497 5 0 0 0 - - -;
#X connect 1 0 13 0;
#X connect 2 0 13 1;
#X connect 3 0 13 2;
#X connect 4 0 13 0;
#X connect 5 0 9 0;
#X connect 6 0 9 1;
#X connect 7 0 9 2;
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 11 0 9 0;
#X connect 13 0 0 0;
#X connect 15 0 26 0;
#X connect 16 0 15 1;
#X connect 17 0 16 0;
#X connect 18 0 15 2;
#X connect 19 0 18 0;
#X connect 20 0 15 0;
#X connect 21 0 20 0;
#X connect 22 0 15 0;
#X connect 23 0 15 1;
#X connect 24 0 15 2;
#X connect 25 0 15 0;
#X connect 29 0 32 0;
#X connect 29 1 33 0;
#X connect 30 0 29 0;
#X connect 31 0 29 1;
#X connect 37 0 36 0;
#X connect 38 0 41 0;
#X connect 39 0 38 0;
#X connect 40 0 38 1;
#X connect 43 0 45 0;
#X connect 44 0 43 0;
#X connect 46 0 54 0;
#X connect 47 0 50 0;
#X connect 48 0 46 1;
#X connect 49 0 48 0;
#X connect 50 0 46 1;
#X connect 51 0 52 0;
#X connect 53 0 46 0;
#X connect 56 0 59 0;
#X connect 57 0 56 0;
#X connect 58 0 56 1;
#X connect 62 0 56 1;
#X connect 63 0 56 0;