Debian Codegraph @

doc/8.topics/expr.htm

raw
1 <!DOCTYPE html>
2 <html lang="en-us">
3 <head>
4
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta content="text/html; charset=utf-8" http-equiv="content-type">
7 <title>Expr Family Objects by Shahrokh Yadegari</title>
8 <style>
9
10 HTML {
11 background: #ffffff;
12 color: #000000;
13 font-size: 12.7pt; /* this is because there were many <p> missing. We can change this value to 7pt to easily detect missing <p> */
14 font-family: Helvetica, Arial, sans-serif;
15 line-height: 1.6;
16 }
17 BODY {
18 width: 6.5in;
19 margin-left: 0.8in;
20 }
21 H1 {
22 font-size: 32.7pt;
23 text-align: center;
24 }
25 H2 {
26 font-size: 22.7pt;
27 text-align: left;
28 }
29 H3 {
30 font-size: 14.7pt;
31 text-align: left;
32 }
33 H4 {
34 font-size: 12.7pt;
35 text-align: left;
36 }
37 H5 {
38 font-size: 10.7pt;
39 text-align: left;
40 }
41 H6 {
42 font-size: 10.7pt;
43 text-align: left;
44 }
45 PRE {
46 font-size: 80%;
47 background-color:rgb(240, 240, 240);
48 text-align: left;
49 border-radius: 8px;
50 padding: 8px;
51 }
52
53 ol{
54 font-size: 14.5pt;
55 text-align: left;
56 line-height: 1.6;
57 }
58
59
60 p{
61 font-size: 12pt;
62 text-align: left;
63 line-height: 1.6;
64 }
65
66 hr {
67 border:2px solid;
68 }
69
70 table {
71 border: 1px solid black; /* Replaces border="1" */
72 border-collapse: collapse; /* Ensures borders between cells are merged */
73 }
74
75 td, th {
76 padding: 10px; /* Replaces cellpadding="10" */
77 border: 1px solid black; /* Optional: adds border to cells */
78 }
79 tr td:nth-child(3) {
80 text-align: left;
81 vertical-align:top;
82 }
83
84 tbody tr {
85 vertical-align: top;
86 }
87
88
89 dl {
90 display: grid;
91 grid-template-columns: auto auto;
92 }
93
94 dd {
95 margin: 0
96 }
97
98 /* standard link */
99
100 a:link {
101 text-decoration: none;
102 color: #333399;
103 }
104
105 a:visited {
106 text-decoration: none;
107 color: #333399;
108 }
109
110 a:hover {
111 text-decoration: underline;
112 /*color: grey;*/
113 color: black;
114 background-color:rgb(238, 238, 228);
115 }
116
117 a:active {
118 text-decoration: none;
119 color: #333399;
120 }
121
122
123 /* green link (like a button) */
124
125 a.green:link {
126 font-family:sans-serif;
127 background-color: #4CAF50; /* Green */
128 border-radius: 4px;
129 color: white;
130 padding: 0px 8px ;
131 text-align: center;
132 text-decoration: none;
133 display: inline-block;
134 font-size: 80%;
135
136 }
137
138 a.green:hover {
139 text-decoration: none;
140 background-color: #4CAF50;
141 }
142
143 a.green:visited {
144 color: white;
145 }
146
147 /* standard images */
148
149 IMG {
150
151 display: block;
152 margin: 0 auto;
153 width: auto;
154
155
156 }
157
158 mark {
159 background-color: rgb(255, 240, 179);
160 }
161
162 p.fig {
163 text-align: center;
164 }
165
166 /* responsive css for small "devices" */
167
168 @media screen and (max-device-width: 700px) {
169 body {
170 padding: 10px;
171 width: auto;
172 margin-left: 6px;
173 }
174 }
175
176 /* responsive css for small "browser window" */
177
178 @media screen and (max-width: 701px) {
179 body {
180 padding: 10px;
181 width: auto;
182 margin-left: 6px;
183 }
184 }
185 </style>
186
187 </head>
188 <body>
189
190 <h2>
191 Expr family of objects<br>
192 by <a href="https://yadegari.org">Shahrokh Yadegari</a></h2>
193
194 <br> Back to the <a href="https://yadegari.org/software/">Software Page</a>
195 <br>
196 <br>
197
198 <hr/>
199
200 <h2 id="Expr..Expr...Fexpr.">[expr], [expr~], [fexpr~]</h2>
201
202 <p>Based on original sources from IRCAM&rsquo;s jMax
203 Released under BSD License.</p>
204
205 <p>The <strong>[expr]</strong> family is a set of C-like expression evaluation objects for the graphical music language Pure Data. It used to come as an &lsquo;extra&rsquo; external, but it is now a built-in native object.</p>
206
207 <p><strong>[expr]</strong> runs in control rate and evaluates C-like expressions. See below for the list of operators. Multiple expressions separated by semicolons can be defined in a single <strong>[expr]</strong> object and this results in multiple outlets (up to 100, each for each expression). Expressions are evaluated from right to left (which means that the bottom expression will be the first executed.) The number of inlets in expr are defined by variables that take a few different forms: <strong>$i#</strong>, <strong>$i#</strong> and <strong>$s#</strong> for 'integers', 'floats' and 'symbols' ('#' is an inlet number from 1 up to 100, ordered from left to right). As an example, we can have 3 inlets defined as "$i1", "$f2" and "$s3", where:</p>
208
209 <ul>
210 <li><strong>$i1</strong> is the input from the first (left) inlet and is treated as an integer</li>
211 <li><strong>$f2</strong> is the input from the second (middle) inlet and is treated as a float</li>
212 <li><strong>$s3</strong> is the input from the third (middle) and expects a symbol</li>
213 </ul>
214
215
216 <p>Arrays and variables (defined using the [value] object) can be accessed the same way one dimensional arrays are accessed in C; for example, &ldquo;valx + 10&rdquo; will be evaluated to the value of variable &lsquo;valx&rsquo; + 10 and &ldquo;tabname[5]&rdquo; will be evaluated to be the 5th element of an array named &ldquo;tabname&rdquo;. The name of the arrays can also be given by an input; for example &ldquo;$s2[5]&rdquo; will be evaluated to be the 5 element of the array whose symbol has been passed in inlet 2.</p>
217
218 <p>Type conversion from a float input to an integer is done automatically if the inlet is defined as an integer. Conversely, you can convert it explicitly by using functions (see below for the list of functions).</p>
219
220 <p><strong>[expr]</strong> is also able to manipulate and output symbols. A symbol is written as a string with quotes around it, such as "hello", or as a symbol input <strong>$s#</strong> such as <strong> $s2</strong>. For more information about supported string manipulation functions see below.
221
222 <p><strong>[expr~]</strong> is designed to efficiently combine signal and control stream processing by vector operations on the basis of the audio block size. The operations, functions, and syntax for <strong>[expr~]</strong> is just like <strong>[expr]</strong> with the addition of the <strong>$v#</strong> variable for signal vector input (also numbered up to 100). The '$v' is needed at least for the first and main input, so:</p>
223
224 <ul>
225 <li><strong>$v1</strong> - means the first inlet is a signal input</li>
226 <li><strong>$i2</strong> - means the second inlet is an integer input</li>
227 <li><strong>$f2</strong> - means the third inlet is a float input</li>
228 <li><strong>$s4</strong> - means the fourth inlet is a symbol input</li>
229 </ul>
230
231
232 <p>The result of an expression from <strong>[expr~]</strong> is also an audio signal and multiple expressions up to 100 can also be defined via semicolons.</p>
233
234 <p>Note for MSP users: Currently in the MSP version all signal inputs should come first followed by other types of inlet. (There seems to be no way of mixing signal and other types of inlets in their order in Max/MSP, if you know otherwise, please let me know.) This means that signal inlets cannot be mixed with other types of inlets. For example, [expr~ $v1 + $f2 + $v3] is not legal. The second and third inlet should be switched and [expr~ $v1 + $v2 + $f3] should be used instead. In Pd you can mix them in any way you want.</p>
235
236 <p>The <strong>[fexpr~]</strong> object provides a flexible mechanism for building FIR and IIR filters by evaluating expressions on a sample by sample basis and providing access to prior samples of the input and output audio streams. When fractional offset is used, <strong>[fexpr~]</strong> uses linear interpolation to determine the value of the indexed sample. The operations, functions, and syntax for <strong>[fexpr~]</strong> is just like <strong>[expr]</strong> with the addition of <strong>$x#</strong> and <strong>$y#</strong> variables. The <strong>[fexpr~]</strong> object can access previous input and output samples up to the block size (64 by default).<p>
237
238
239 <p><strong>$x#</strong> is used to denote a signal input whose samples we would like to access. The syntax is $x followed by '#' (the inlet number up to 100) and the samples indexed by brackets, for example $x1[-1] specifies the previous sample of the first inlet. Therefore, if we are to build a simple filter which replaces every sample by the average of that sample and its previous one, we would use <strong>[fexpr~ ($x1[0] + $x1[-1]) / 2]</strong>. For ease of when the brackets are omitted, the current sample is implied, so we can write the previous filter expression as follows: <strong>[fexpr~ ($x1 + $x1[-1]) / 2]</strong>. To build IIR filters <strong>$y#</strong> is used to access the previous output samples indexed from -1 inside brackets. Note now that '#' here is used to define the outlet number.</p>
240
241 <p>The first inlet also needs to be a signal input ($x1), the output of <strong>[fexpr~]</strong> is a signal output and multiple expressions can also be defined via semicolons and each will correspond to an outlet that can be accessed by '$y#'. Note that '$v#' is not allowed in <strong>[fexpr~]</strong>, so:</p>
242
243 <ul>
244 <li><strong>$x1[n]</strong> - means the first inlet is a signal input and 'n' is an index from 0 to -block size</li>
245 <li><strong>$y1[n]</strong> - is used to access output samples from the first expression and 'n' is an index from -1 to -block size</li>
246 <li><strong>$i2</strong> - means the second inlet is an integer input</li>
247 <li><strong>$f2</strong> - means the third inlet is a float input</li>
248 <li><strong>$s4</strong> - means the fourth inlet is a symbol input</li>
249 </ul>
250
251 <hr/>
252
253 <h3 id="operators">The operators [expr], [expr~] and [fexpr~] support (listed from highest precedence to lowest) are as follows:</h3>
254
255 <dl>
256 <dt><code>~</code></dt><dd>One&rsquo;s complement</dd>
257 <dt><code>*</code></dt><dd>Multiply</dd>
258 <dt><code>/</code></dt><dd>Divide</dd>
259 <dt><code>%</code></dt><dd>Modulo</dd>
260 <dt><code>+</code></dt><dd>Add</dd>
261 <dt><code>-</code></dt><dd>Subtract</dd>
262 <dt><code>&lt;&lt;</code></dt><dd>Shift Left</dd>
263 <dt><code>&gt;&gt;</code></dt><dd>Shift Right</dd>
264 <dt><code>&lt;</code></dt><dd>Less than (boolean)</dd>
265 <dt><code>&lt;=</code></dt><dd>Less than or equal (boolean)</dd>
266 <dt><code>&gt;</code></dt><dd>Greater than (boolean)</dd>
267 <dt><code>&gt;=</code></dt><dd>Greater than or equal (boolean)</dd>
268 <dt><code>==</code></dt><dd>Equal (boolean)</dd>
269 <dt><code>!= </code></dt><dd>Not equal (boolean)</dd>
270 <dt><code>&amp; </code></dt><dd>Bitwise And</dd>
271 <dt><code>^</code></dt><dd>Exclusive Or</dd>
272 <dt><code>|</code></dt><dd>Bitwise Or</dd>
273 <dt><code>&amp;&amp;</code></dt><dd>Logical And (boolean)</dd>
274 <dt><code>||</code></dt><dd>Logical Or (boolean)</dd>
275 <dt><code>!</code></dt><dd>Logical Not (boolean)</dd>
276 </dl>
277
278
279 <h3 id="functions">The supported functions for [expr], [expr~] and [fexpr~] are:</h3>
280
281 <B>General Functions</B>
282
283 <table>
284 <thead>
285 <tr>
286 <th> Function <BR>Name </th>
287 <th> # of <BR>Args </th>
288 <th style="text-align: left">
289 Description </th>
290 </tr>
291 </thead>
292 <tbody>
293 <tr>
294 <td> if() </td>
295 <td>3</td>
296 <td> conditional - if (condition, IfTrue-expr, IfFalse-expr) - in [expr~] if &lsquo;condition&rsquo; is a signal, the result will be determined on sample by sample basis (added in version 0.4) </td>
297 </tr>
298 <tr>
299 <td> int() </td>
300 <td> 1 </td>
301 <td> convert to integer </td>
302 </tr>
303 <tr>
304 <td> rint()</td>
305 <td> 1 </td>
306 <td> round a float to a nearby integer </td>
307 </tr>
308 <tr>
309 <td>floor()</td>
310 <td>1</td>
311 <td>largest integral value not greater than argument (added in version 0.4)</td>
312 </tr>
313 <tr>
314 <td>ceil()</td>
315 <td>1</td>
316 <td>smallest integral value not less than argument (added in version 0.4)</td>
317 </tr>
318 <tr>
319 <td>float()</td>
320 <td> 1 </td>
321 <td>convert to float </td>
322 </tr>
323 <tr>
324 <td>min()</td>
325 <td>2</td>
326 <td>minimum</td>
327 </tr>
328 <tr>
329 <td>max()</td>
330 <td>2</td>
331 <td>maximum</td>
332 </tr>
333 <tr>
334 <td>abs()</td>
335 <td>1</td>
336 <td>absolute value (added in version 0.3)</td>
337 </tr>
338 <tr>
339 <td>if()</td>
340 <td>3</td>
341 <td>conditional - if (condition, IfTrue-expr, IfFalse-expr) - in [expr~] if &lsquo;condition&rsquo; is a signal, the result will be determined on sample by sample basis (added in version 0.4)</td>
342 </tr>
343 <tr>
344 <td>isinf()</td>
345 <td>1</td>
346 <td>is the value infinite (added in version 0.4)</td>
347 </tr>
348 <tr>
349 <td>finite()</td>
350 <td>1</td>
351 <td>is the value finite (added in version 0.4)</td>
352 </tr>
353 <tr>
354 <td>isnan()</td>
355 <td>1</td>
356 <td>is the value non a number (added in version 0.4)</td>
357 </tr>
358 <tr>
359 <td>copysign()</td>
360 <td>2</td>
361 <td>copy sign of a number(added in version 0.4)</td>
362 </tr>
363 <tr>
364 <td>imodf()</td>
365 <td>1</td>
366 <td> get signed integer value from floating point number(added in version 0.4)</td>
367 </tr>
368 <tr>
369 <td>modf()</td>
370 <td>1</td>
371 <td>get signed fractional value from floating-point number(added in version 0.4)</td>
372 </tr>
373 <tr>
374 <td>remainder()</td>
375 <td>2</td>
376 <td>floating-point remainder function (added in version 0.4)</td>
377 </tr>
378 <tr>
379 <td>fmod()</td>
380 <td>1</td>
381 <td> floating-point remainder function (added in version 0.4)</td>
382 </tr>
383 </tbody>
384 </table>
385
386 <p>
387 <!-- Power Functions -->
388 <B>Power Functions</B>
389
390 <table>
391 <thead>
392 <tr>
393 <th> Function <BR>Name </th>
394 <th> # of <BR>Args </th>
395 <th style="text-align: left">
396 Description </th>
397 </tr>
398 </thead>
399 <tbody>
400 <tr>
401 <td>pow()</td>
402 <td>2</td>
403 <td>raise to the power of {e.g., pow(x,y) is x to the power of y}</td>
404 </tr>
405 <tr>
406 <td>sqrt()</td>
407 <td>1</td>
408 <td>square root</td>
409 </tr>
410 <tr>
411 <td>exp()</td>
412 <td>1</td>
413 <td>e raised to the power of the argument {e.g., exp(5.2) is e raised to the power of 5.2}</td>
414 </tr>
415 <tr>
416 <td>ln() and log()</td>
417 <td>1</td>
418 <td>natural log</td>
419 </tr>
420 <tr>
421 <td>log10()</td>
422 <td>1</td>
423 <td>log base 10</td>
424 </tr>
425 <tr>
426 <td>fact()</td>
427 <td>1</td>
428 <td>factorial</td>
429 </tr>
430 <tr>
431 <td>erf()</td>
432 <td>1</td>
433 <td>error function (added in version 0.4)</td>
434 </tr>
435 <tr>
436 <td>erfc()</td>
437 <td>1</td>
438 <td>complementary error function (added in version 0.4)</td>
439 </tr>
440 <tr>
441 <td>cbrt()</td>
442 <td>1</td>
443 <td>cube root (added in version 0.4)</td>
444 </tr>
445 <tr>
446 <td>expm1()</td>
447 <td>1</td>
448 <td>exponential minus 1 (added in version 0.4)</td>
449 </tr>
450 <tr>
451 <td>log1p()</td>
452 <td>1</td>
453 <td>logarithm of 1 plus (added in version 0.4)</td>
454 </tr>
455 <tr>
456 <td>ldexp()</td>
457 <td>2</td>
458 <td>multiply floating-point number by integral power of 2 (added in version 0.4)</td>
459 </tr>
460 </tbody>
461 </table>
462
463 <p>
464 <!-- Trigonometric Functions -->
465 <B>Trigonometric (all trigonometric functions here expect radian values)</B>
466 <table>
467 <thead>
468 <tr>
469 <th> Function <BR>Name </th>
470 <th> # of <BR>Args </th>
471 <th style="text-align: left">
472 Description </th>
473 </tr>
474 </thead>
475 <tbody>
476 <tr>
477 <td>sin()</td>
478 <td>1</td>
479 <td>sine</td>
480 </tr>
481 <tr>
482 <td>cos()</td>
483 <td>1</td>
484 <td>cosine</td>
485 </tr>
486 <tr>
487 <td>tan()</td>
488 <td>1</td>
489 <td>tangent</td>
490 </tr>
491 <tr>
492 <td>asin()</td>
493 <td>1</td>
494 <td>arc sine</td>
495 </tr>
496 <tr>
497 <td>acos()</td>
498 <td>1</td>
499 <td>arc cosine</td>
500 </tr>
501 <tr>
502 <td>atan()</td>
503 <td>1</td>
504 <td>arc tangent</td>
505 </tr>
506 <tr>
507 <td>atan2()</td>
508 <td>2</td>
509 <td>arc tangent of 2 variables</td>
510 </tr>
511 <tr>
512 <td>sinh()</td>
513 <td>1</td>
514 <td>hyperbolic sine</td>
515 </tr>
516 <tr>
517 <td>cosh()</td>
518 <td>1</td>
519 <td>hyperbolic cosine</td>
520 </tr>
521 <tr>
522 <td>tanh()</td>
523 <td>1</td>
524 <td>hyperbolic tangent</td>
525 </tr>
526 <tr>
527 <td>asinh()</td>
528 <td>1</td>
529 <td>inverse hyperbolic sine</td>
530 </tr>
531 <tr>
532 <td>acosh()</td>
533 <td>1</td>
534 <td>inverse hyperbolic cosine</td>
535 </tr>
536 <tr>
537 <td>atan()</td>
538 <td>1</td>
539 <td>inverse hyperbolic tangent</td>
540 </tr>
541 <tr>
542 <td>hypot()</td>
543 <td>2</td>
544 <td> euclidean distance function (0 to this location)</td>
545 </tr>
546 </tbody>
547 </table>
548
549
550 <p>
551 <!-- Table Functions -->
552 <B> Table Functions </B>
553 </p>
554 <table>
555 <thead>
556 <tr>
557 <th> Function <BR> Name </th>
558 <th style="text-align:center;"> # of <BR> Args </th>
559 <th style="text-align:left;"> Description</th>
560 </tr>
561 </thead>
562 <tbody>
563 <tr>
564 <td>size()</td>
565 <td>1</td>
566 <td>size of a table</td>
567 </tr>
568 <tr>
569 <td>sum()</td>
570 <td>1</td>
571 <td>sum of all elements of a table</td>
572 </tr>
573 <tr>
574 <td>Sum()</td>
575 <td>3</td>
576 <td>sum of elements of a specified boundary of a table</td>
577 </tr>
578 <tr>
579 <td>avg()</td>
580 <td>1</td>
581 <td>averages all elements of a table</td>
582 </tr>
583 <tr>
584 <td>Avg()</td>
585 <td>3</td>
586 <td>averages elements of a specified boundary of a table</td>
587 </tr>
588 </tbody>
589 </table>
590
591
592 <p>
593 <strong>
594 Acoustics Functions
595 </strong>
596 </p>
597 <table>
598 <thead>
599 <tr>
600 <th> Function <BR> Name </th>
601 <th> # of <BR>Args </th>
602 <th style="text-align:left;"> Description </th>
603 </tr>
604 </thead>
605 <tbody>
606 <tr>
607 <td> mtof() </td>
608 <td> 1 </td>
609 <td> convert MIDI pitch to frequency in hertz </td>
610 </tr>
611 <tr>
612 <td> ftom() </td>
613 <td> 1 </td>
614 <td> convert frequency in hertz to MIDI pitch </td>
615 </tr>
616 <tr>
617 <td> dbtorms() </td>
618 <td> 1 </td>
619 <td> convert db to rms </td>
620 </tr>
621 <tr>
622 <td> rmstodb() </td>
623 <td> 1 </td>
624 <td> convert rms to db </td>
625 </tr>
626 <tr>
627 <td> powtodb() </td>
628 <td> 1 </td>
629 <td> convert power to db </td>
630 </tr>
631 <tr>
632 <td> dbtopow() </td>
633 <td> 1 </td>
634 <td> convert db to power </td>
635 </tr>
636 </tbody>
637 </table>
638
639 <p>
640 <b> String Manipulation Functions (the ones that return a symbol only work for [expr])</b>
641 <table>
642 <thead>
643 <tr>
644 <th style="width:50%;text-align:left;">Function <BR> Name </th>
645 <th> # of <BR> Args </th>
646 <th> returns </th>
647 <th style="text-align:left;width:30%"> Description </th>
648 </tr>
649 </thead>
650 <tbody>
651 <tr>
652 <td> symbol(int/float/symbol [, int X, int Y])<BR>sym(int/float/symbol) </td>
653 <td> 0, 1, 2, or 3 </td>
654 <td> symbol </td>
655 <td> symbol formatted based on the type of the input
656 <BR>
657 <BR>
658 0 argument will result in an empty symbol
659 <BR>
660 <BR>
661
662 1 argument will produce a symbol from string/symbol, int, float, according to the %s, %d, %f syntax in sprintf() respectively
663 <BR>
664 <BR>
665 2 argument (sym, X) will produce a symbol from string/symbol, int, float, according to the %Xs, %.Xd, %.Xf syntax in sprintf() respectively
666
667 <BR>
668 <BR>
669
670 3 arguments (sym, X, Y) will produce a symbol from string/symbol, int, float, according to the %Y.Xs, %Y.Xd, %Y.Xf syntax in sprintf() respectively
671 </tr>
672 <tr>
673 <td> var(symbol)</td>
674 <td> 1 </td>
675 <td> float </td>
676 <td> var() will treat the value of the symbol argument as a variable name and returns the value of the variable
677 </tr>
678 <tr>
679 <td> strlen(symbol) </td>
680 <td> 1 </td>
681 <td> int </td>
682 <td> length of symbol
683 </tr>
684 <tr>
685 <td> tolower(symbol)</td>
686 <td> 1</td>
687 <td> symbol </td>
688 <td> convert all upper-case letters of the string to the corresponding lower-case letters
689 </td>
690 </tr>
691 <tr>
692 <td> tonlower(symbol, int)</td>
693 <td> 2</td>
694 <td> symbol </td>
695 <td> convert n'th character of the string from upper-case letter to the corresponding lower-case letter
696 </td>
697 </tr>
698 <tr>
699 <td>
700 toupper(symbol)</td>
701 <td> 1</td>
702 <td> symbol </td>
703 <td> convert all lower-case letters of the string to the corresponding upper-case letters
704 </td>
705 </tr>
706 <tr>
707 <td> tonupper(symbol, int)</td>
708 <td> 2</td>
709 <td> symbol </td>
710 <td> convert n'th character of the string from lower-case letter to the corresponding upper-case letter
711 </td>
712 </tr>
713 <tr>
714 <td> strcat(symbol, symbol, ...)</td>
715 <td> var</td>
716 <td> symbol </td>
717 <td> Concatenate two or more strings
718 </td>
719 </tr>
720 <tr>
721 <td> strncat(symbol, symbol, int)</td>
722 <td> 3</td>
723 <td> symbol </td>
724 <td> Concatenate the first string, by no more than n characters of the second string
725 </td>
726 </tr>
727 <tr>
728 <td> strcmp(symbol, symbol)</td>
729 <td> 2</td>
730 <td> int </td>
731 <td> Compare two strings; return an integer greater than, equal to, or less than 0, according as the first string is greater than,
732 equal to, or less than the second string.
733 </td>
734 </tr>
735 <tr>
736 <td> strncmp(symbol, symbol, int)</td>
737 <td> 3</td>
738 <td> int </td>
739 <td> Compare no more than n characters of two strings; return an integer greater than, equal to, or less than 0, according as the first string is greater than,
740 </tr>
741 <tr>
742 <td> strcasecmp(symbol, symbol)</td>
743 <td> 2</td>
744 <td> int </td>
745 <td> similar to strcmp() but ignore case of the letters
746 </td>
747 </tr>
748 <tr>
749 <td> strncasecmp(symbol, symbol, int)</td>
750 <td> 3</td>
751 <td> int </td>
752 <td> similar to strncmp() but ignore case of the letters
753 </td>
754 </tr>
755 <tr>
756 <td> strpbrk(symbol, symbol)</td>
757 <td> 2</td>
758 <td> symbol </td>
759 <td> In the first string locate the first
760 occurrence of any character in the second (character set) string and
761 return a substring of the first string starting with the found character.
762 If no characters from second string is found return 0;
763 </td>
764 </tr>
765 <tr>
766 <td> strspn(symbol, symbol)</td>
767 <td> 2</td>
768 <td> int </td>
769 <td> return the string array index of the first character of the first string which is not in the
770 second (charset) string, else return the index of the first null character.
771 </td>
772 </tr>
773 <tr>
774 <td> strcspn(symbol, symbol)</td>
775 <td> 2</td>
776 <td> int </td>
777 <td> return the string array index of the first character of the
778 first string which is also in charset, else return the index of the first null character.
779 </td>
780 </tr>
781 </tbody>
782 </table>
783
784
785 <BR>
786 <p>
787 <hr/>
788
789 <h3 id="CHANGELOG:">CHANGELOG:</h3>
790
791 <h3 id="version.0.58">version 0.58</h3>
792 <ul>
793 <li>Added string functions in [expr]; now expr can output symbols (major redesign) </li>
794 <li>Provide better error messages; now expr prints the [expr] string when reporting errors
795 <li>Fixed the [expr~] array[0]" bug
796 <li>Fixed a memory issue were extra unused output vectors were <BR>
797 allocated for each inlet
798 <li> NOTE: the syntax func("$s#", ...) is now deprecated and func($s#, ...) should be used
799 </ul>
800
801 <h3 id="version.0.57">version 0.57</h3>
802
803 <ul>
804 <li>fixed a bug in fact().</li>
805 <li>fact() (factorial) now calculates and returns its value in double</li>
806 <li>fixed the bad lvalue bug - &ldquo;4 + 5 = 3&rdquo; was not caught before</li>
807 <li>Added mtof(), mtof(), dbtorms(), rmstodb(), powtodb(), dbtopow()</li>
808 </ul>
809
810
811 <h3 id="version.0.56">version 0.56</h3>
812
813 <ul>
814 <li>[fexpr~] now accepts a float in its first input.</li>
815 <li>Added avg() and Avg() back to the list of functions</li>
816 </ul>
817
818
819 <h3 id="version.0.55">version 0.55</h3>
820
821 <ul>
822 <li>The arrays now redraw after a store into one of their members</li>
823 <li>ex_if() (the &ldquo;if()&rdquo; function is reworked to only evaluate either the left or the right args depending on the truth value of the condition. However, if the condition is an audio vector, both the left and the right are evaluated regardless.</li>
824 <li>priority of &lsquo;,&rsquo; and &lsquo;=&rsquo; was switched to fix the bug of using store &ldquo;=&rdquo; in functions with multiple arguments, which caused an error during execution.</li>
825 <li>The number of inlet and outlets (MAX_VARS) is now set at 100</li>
826 </ul>
827
828
829 <h3 id="version.0.5">version 0.5</h3>
830
831 <ul>
832 <li>[expr], [expr~], and [fexpr~] are now built-in native objects.</li>
833 <li>minor fixes/improvements.</li>
834 </ul>
835
836
837 <h3 id="version.0.4">version 0.4</h3>
838
839 <ul>
840 <li>[expr], [expr~], and [fexpr~] now support multiple expressions separated by semicolons which results in multiple outlets.</li>
841 <li>Variables are supported now in the same way they are supported in C. - Variables have to be defined with the &ldquo;value&rdquo; object prior to execution.</li>
842 <li>A new if function if (condition-expression, IfTrue-expression, IfFalse-expression) has been added.</li>
843 <li>New math functions added.</li>
844 <li>New shorthand notations for [fexpr~] have been added.
845
846 <ul>
847 <li>$x ->$x1[0] $x# -> $x#[0]</li>
848 <li>$y = $y1[-1] and $y# = $y#[-1]</li>
849 </ul>
850 </li>
851 <li>New &lsquo;set&rsquo; and &lsquo;clear&rsquo; methods were added for [fexpr~]
852
853 <ul>
854 <li>clear - clears all the past input and output buffers</li>
855 <li>clear x# - clears all the past values of the #th input</li>
856 <li>clear y# - clears all the past values of the #th output</li>
857 <li>set x# val-1 val-2 &hellip; - sets as many supplied value of the #th input;
858 e.g., &ldquo;set x2 3.4 0.4&rdquo; - sets x2[-1]=3.4 and x2[-2]=0.4</li>
859 <li>set y# val-1 val-2 &hellip; - sets as many supplied values of the #th output;
860 e.g, &ldquo;set y3 1.1 3.3 4.5&rdquo; - sets y3[-1]=1.1 y3[-2]=3.3 and y3[-3]=4.5;</li>
861 <li>set val val &hellip; - sets the first past values of each output; e.g.,
862 e.g., &ldquo;set 0.1 2.2 0.4&rdquo; - sets y1[-1]=0.1, y2[-1]=2.2, y3[-1]=0.4</li>
863 </ul>
864 </li>
865 </ul>
866
867 </body>
868 </html>