aboutsummaryrefslogtreecommitdiff
path: root/pd/extra/expr~/help-expr.pd
blob: 98ca696f1aaffc8e9ce75649ea861744de6c83ea (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#N canvas 0 0 1024 745 10;
#X obj 75 416 expr 1;
#X floatatom 239 384 0 0 0;
#X floatatom 75 446 0 0 0;
#X msg 75 388 bang;
#X obj 143 414 expr 2 + 3;
#X msg 143 387 bang;
#X floatatom 143 442 0 0 0;
#X floatatom 238 442 0 0 0;
#X obj 238 414 expr 2+$f1;
#X floatatom 76 485 0 0 0;
#X floatatom 76 542 0 0 0;
#X obj 76 514 expr $f1 * $f2;
#X floatatom 155 485 0 0 0;
#N canvas 0 0 450 300 graph1 0;
#X coords 0 10 10 0 200 150 1;
#X array array1 10 float 0;
#X restore 472 362 graph;
#X floatatom 77 580 0 0 0;
#X floatatom 77 636 0 0 0;
#X floatatom 236 484 0 0 0;
#X floatatom 236 541 0 0 0;
#X obj 236 513 expr $s2[$f1];
#X msg 309 485 symbol array1;
#X obj 77 608 expr sin(2 * 3.14159 * $f1 / 360);
#X msg 429 554 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
#X text 81 345 expr examples:;
#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
;
#X text 66 188 Syntyax:;
#X text 67 260 $f#: float input variable;
#X text 68 275 $s#: symbol input variable;
#X text -37 708 expr~ examples:;
#X obj 30 911 print~;
#X msg 67 890 bang;
#X obj 30 832 sig~ 440;
#X floatatom 103 849 0 0 0;
#X floatatom 30 809 0 0 0;
#X obj 30 872 expr~ $v1*$f2;
#X obj 139 912 print~;
#X msg 155 891 bang;
#X floatatom 139 824 0 0 0;
#X floatatom 212 826 0 0 0;
#X floatatom 411 847 0 0 0;
#X floatatom 298 823 0 0 0;
#X obj 298 850 osc~;
#X msg 526 670 \; pd dsp 0;
#X msg 448 672 \; pd dsp 1;
#X text 451 649 audio on;
#X text 534 648 audio off;
#X text 274 314 comment;
#X text 9 792 vector times scalar;
#X text 141 792 vector;
#X obj 297 910 dac~;
#X text 295 801 frequency;
#X text 427 829 amplitude;
#X text 497 116 Used for expr~ only:;
#X text 499 139 $v#: signal (vector) input (vector by vector evaluation)
;
#X text 494 172 Used for fexpr~ only:;
#X text 495 242 $y[n]: the output value indexed by n where n has to
satisfy 0 > n >= -vector size.;
#X text 489 282 (the vector size can be changed by the "block~" object.)
;
#X text 493 191 $x#[n]: the sample from inlet # indexed by n where
n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
$x#[0] \, specifying the current sample);
#X floatatom 81 1300 0 0 0;
#X floatatom 214 1319 0 0 0;
#X msg 181 1279 -10;
#X text 8 1099 fexpr~ examples:;
#X obj 80 1567 print~;
#X msg 88 1547 bang;
#X floatatom 80 1471 0 0 0;
#X obj 80 1500 sig~ 1;
#X obj 81 1343 fexpr~ ($x1[$f2]+$x1)/2;
#X obj 80 1528 fexpr~ $x1+$y[-1];
#X floatatom 590 1362 0 0 0;
#X floatatom 750 1383 0 0 0;
#X obj 585 1452 dac~;
#X obj 587 1403 fexpr~ ($x1[$f2/1000]+$x1)/2;
#X msg 819 1313 0 10000;
#X obj 750 1364 line 0;
#X msg 753 1314 -10000;
#X obj 75 1385 dac~;
#X text 51 1223 Simple FIR filter;
#X text 512 1130 Simple FIR filter using fractional offset;
#X msg 659 1314 -10000 10000;
#X obj 590 1383 osc~ 2205;
#X msg 599 1339 1102.5;
#X msg 817 1338 0 10000;
#X msg 751 1339 -20000;
#X msg 657 1339 -20000 10000;
#X msg 590 1314 2205;
#X text 88 1611 end;
#X msg 503 1308 start;
#X msg 505 1330 stop;
#X msg 12 1280 start;
#X msg 11 1305 stop;
#X msg 30 1465 start;
#X msg 29 1490 stop;
#X obj 446 1331 loadbang;
#X obj -27 1491 loadbang;
#X obj -44 1305 loadbang;
#X text 572 1287 frequency;
#X text 662 1296 of the simple filter;
#X msg 248 1278 -20;
#X obj 81 1321 osc~ 2205;
#X msg 111 1277 1102.5;
#X msg 65 1277 2205;
#X msg 215 1278 0;
#X text 78 1441 simple accumulator defined as and an IIR filter;
#X obj 139 871 expr~ $v1*$v2;
#X text 7 1144 NOTE: fexpr~ could use lots of CPU power \, by default
fexpr~ is on when it is loaded. In this page we are turning them off
with loadbang \, so to hear them you have to turn them on explicitly.
You can use the "start" and "stop" messages to start and stop fexpr~
and expr~;
#X text 65 101 expr~ is used for expression evaluaion of signal data
on the vector by vector basis;
#X text 66 85 expr is used for expression evaluaion of control data
;
#X text 661 1284 index defining the frequency;
#X text 50 1236 -10 offset will fully filter audio frequency of 2205
\, and -20 offset will filter audio at frequency of 1102.5;
#X text 514 1211 Thus \, the offset -10000 will filter audio at frequency
of 2205 and the offset value -20000 will filter the audio at frequency
of 1102.5.;
#X text 513 1157 When fractional offset is used \, fexpr~ determines
indexed by linear interpolation. In the following example the offset
value is divided by 1000 \, thus we can continuously change the offset
without an audible click in the output.;
#X text 243 1314 If you change this value you;
#X text 245 1326 hear a click;
#X text 77 670 make sure you turn on audio for the expr~ and fexpr~
examples;
#X text 64 38 For a more detailed documentaion refer to http://www.crca.ucsd.edu/~yadegari/expr.html
;
#X text 67 203 The syntax is very close to how expressions are written
in C. Variables are specified as follows where the '#' stands for the
inlet number:;
#X text 68 246 $i#: integer input variable;
#X text 67 138 fexpr~ is used for expression evaluaion on sample level
data \; i.e. \, filter design. Warning: fexpr~ is very cpu intensive.
;
#X floatatom 792 826 5 0 0;
#X obj 545 875 tabsend~ a1;
#N canvas 0 0 450 300 graph4 0;
#X coords 0 1 63 -1 200 140 1;
#X array a1 64 float 0;
#X restore 546 897 graph;
#X obj 545 852 expr~ max(min($v1 \, $f2/10) \, -$f2/10);
#X obj 545 828 osc~ 4000;
#X text 13 730 NOTES: the first inlet of expr~ cannot be a $f1 or $i1
\, this may change in later releases;
#X text 535 775 A simple limiter example;
#X text 718 800 Move the value below between 0 and 10 to change the
limiter threshold;
#X obj 410 714 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144
-1 -1 0 1;
#X obj 297 871 expr~ $v1*$f2/128;
#X text 641 12 updated for Pd 0.35-35 test 8 and expr* 0.3;
#X connect 0 0 2 0;
#X connect 1 0 8 0;
#X connect 3 0 0 0;
#X connect 4 0 6 0;
#X connect 5 0 4 0;
#X connect 8 0 7 0;
#X connect 9 0 11 0;
#X connect 11 0 10 0;
#X connect 12 0 11 1;
#X connect 14 0 20 0;
#X connect 16 0 18 0;
#X connect 18 0 17 0;
#X connect 19 0 18 1;
#X connect 20 0 15 0;
#X connect 29 0 28 0;
#X connect 30 0 33 0;
#X connect 31 0 33 1;
#X connect 32 0 30 0;
#X connect 33 0 28 0;
#X connect 35 0 34 0;
#X connect 36 0 102 0;
#X connect 37 0 102 1;
#X connect 38 0 126 1;
#X connect 39 0 40 0;
#X connect 40 0 126 0;
#X connect 57 0 97 0;
#X connect 58 0 65 1;
#X connect 59 0 58 0;
#X connect 62 0 61 0;
#X connect 63 0 64 0;
#X connect 64 0 66 0;
#X connect 65 0 74 0;
#X connect 65 0 74 1;
#X connect 66 0 61 0;
#X connect 67 0 78 0;
#X connect 68 0 70 1;
#X connect 70 0 69 0;
#X connect 70 0 69 1;
#X connect 71 0 72 0;
#X connect 72 0 68 0;
#X connect 73 0 72 0;
#X connect 77 0 72 0;
#X connect 78 0 70 0;
#X connect 79 0 67 0;
#X connect 80 0 72 0;
#X connect 81 0 72 0;
#X connect 82 0 72 0;
#X connect 83 0 67 0;
#X connect 85 0 70 0;
#X connect 86 0 70 0;
#X connect 87 0 65 0;
#X connect 88 0 65 0;
#X connect 89 0 66 0;
#X connect 90 0 66 0;
#X connect 91 0 86 0;
#X connect 92 0 90 0;
#X connect 93 0 88 0;
#X connect 96 0 58 0;
#X connect 97 0 65 0;
#X connect 98 0 57 0;
#X connect 99 0 57 0;
#X connect 100 0 58 0;
#X connect 102 0 34 0;
#X connect 117 0 120 1;
#X connect 120 0 118 0;
#X connect 121 0 120 0;
#X connect 125 0 38 0;
#X connect 126 0 48 0;
#X connect 126 0 48 1;