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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../../img/favicon.ico">
<title> basics - Faust Libraries</title>
<link href="../../css/bootstrap.min.css" rel="stylesheet">
<link href="../../css/font-awesome.min.css" rel="stylesheet">
<link href="../../css/base.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
<link href="../../css/extra.css" rel="stylesheet">
<script src="../../js/jquery-1.10.2.min.js" defer></script>
<script src="../../js/bootstrap.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="../.."><img src="../../img/faustText.svg" width="150px"> Libraries</a>
<!-- Expander button -->
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar-collapse">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Expanded navigation -->
<div id="navbar-collapse" class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../../organization/" class="dropdown-item"> Organization </a>
</li>
<li>
<a href="../../standardFunctions/" class="dropdown-item"> Standard Functions </a>
</li>
<li>
<a href="../../contributing/" class="dropdown-item"> Contributing </a>
</li>
<li>
<a href="../../community/" class="dropdown-item"> Community </a>
</li>
<li>
<a href="../../about/" class="dropdown-item"> Copyright/License </a>
</li>
</ul>
</li>
<li class="navitem">
<a href="../" class="nav-link">Index</a>
</li>
<li class="dropdown active">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Libraries <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="../aanl/" class="dropdown-item"> antialiased </a>
</li>
<li>
<a href="../analyzers/" class="dropdown-item"> analyzers </a>
</li>
<li>
<a href="./" class="dropdown-item active"> basics </a>
</li>
<li>
<a href="../compressors/" class="dropdown-item"> compressors </a>
</li>
<li>
<a href="../delays/" class="dropdown-item"> delays </a>
</li>
<li>
<a href="../demos/" class="dropdown-item"> demos </a>
</li>
<li>
<a href="../dx7/" class="dropdown-item"> dx7 </a>
</li>
<li>
<a href="../envelopes/" class="dropdown-item"> envelopes </a>
</li>
<li>
<a href="../fds/" class="dropdown-item"> fds </a>
</li>
<li>
<a href="../filters/" class="dropdown-item"> filters </a>
</li>
<li>
<a href="../hoa/" class="dropdown-item"> hoa </a>
</li>
<li>
<a href="../interpolators/" class="dropdown-item"> interpolators </a>
</li>
<li>
<a href="../maths/" class="dropdown-item"> maths </a>
</li>
<li>
<a href="../mi/" class="dropdown-item"> mi </a>
</li>
<li>
<a href="../misceffects/" class="dropdown-item"> misceffects </a>
</li>
<li>
<a href="../noises/" class="dropdown-item"> noises </a>
</li>
<li>
<a href="../oscillators/" class="dropdown-item"> oscillators </a>
</li>
<li>
<a href="../phaflangers/" class="dropdown-item"> phaflangers </a>
</li>
<li>
<a href="../physmodels/" class="dropdown-item"> physmodels </a>
</li>
<li>
<a href="../quantizers/" class="dropdown-item"> quantizers </a>
</li>
<li>
<a href="../reducemaps/" class="dropdown-item"> reducemaps </a>
</li>
<li>
<a href="../reverbs/" class="dropdown-item"> reverbs </a>
</li>
<li>
<a href="../routes/" class="dropdown-item"> routes </a>
</li>
<li>
<a href="../signals/" class="dropdown-item"> signals </a>
</li>
<li>
<a href="../soundfiles/" class="dropdown-item"> soundfiles </a>
</li>
<li>
<a href="../spats/" class="dropdown-item"> spats </a>
</li>
<li>
<a href="../synths/" class="dropdown-item"> synths </a>
</li>
<li>
<a href="../vaeffects/" class="dropdown-item"> vaeffects </a>
</li>
<li>
<a href="../version/" class="dropdown-item"> version </a>
</li>
<li>
<a href="../wdmodels/" class="dropdown-item"> wdmodels </a>
</li>
<li>
<a href="../webaudio/" class="dropdown-item"> webaudio </a>
</li>
</ul>
</li>
<li class="navitem">
<a href="../../about/" class="nav-link">About</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a href="#" class="nav-link" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="row"><div class="col-md-3"><div class="navbar-light navbar-expand-md bs-sidebar hidden-print affix" role="complementary">
<div class="navbar-header">
<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target="#toc-collapse" title="Table of Contents">
<span class="fa fa-angle-down"></span>
</button>
</div>
<div id="toc-collapse" class="navbar-collapse collapse card bg-secondary">
<ul class="nav flex-column">
<li class="nav-item" data-level="1"><a href="#basicslib" class="nav-link">basics.lib</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#conversion-tools" class="nav-link">Conversion Tools</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#basamp2sec" class="nav-link">(ba.)samp2sec</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#basec2samp" class="nav-link">(ba.)sec2samp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#badb2linear" class="nav-link">(ba.)db2linear</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#balinear2db" class="nav-link">(ba.)linear2db</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#balin2loggain" class="nav-link">(ba.)lin2LogGain</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#balog2lingain" class="nav-link">(ba.)log2LinGain</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batau2pole" class="nav-link">(ba.)tau2pole</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapole2tau" class="nav-link">(ba.)pole2tau</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bamidikey2hz" class="nav-link">(ba.)midikey2hz</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bahz2midikey" class="nav-link">(ba.)hz2midikey</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#basemi2ratio" class="nav-link">(ba.)semi2ratio</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baratio2semi" class="nav-link">(ba.)ratio2semi</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bacent2ratio" class="nav-link">(ba.)cent2ratio</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baratio2cent" class="nav-link">(ba.)ratio2cent</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapianokey2hz" class="nav-link">(ba.)pianokey2hz</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bahz2pianokey" class="nav-link">(ba.)hz2pianokey</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#counters-and-timetempo-tools" class="nav-link">Counters and Time/Tempo Tools</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#bacounter" class="nav-link">(ba.)counter</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bacountdown" class="nav-link">(ba.)countdown</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bacountup" class="nav-link">(ba.)countup</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#basweep" class="nav-link">(ba.)sweep</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batime" class="nav-link">(ba.)time</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baramp" class="nav-link">(ba.)ramp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baline" class="nav-link">(ba.)line</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batempo" class="nav-link">(ba.)tempo</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baperiod" class="nav-link">(ba.)period</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulse" class="nav-link">(ba.)pulse</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulsen" class="nav-link">(ba.)pulsen</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bacycle" class="nav-link">(ba.)cycle</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babeat" class="nav-link">(ba.)beat</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulse_countup" class="nav-link">(ba.)pulse_countup</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulse_countdown" class="nav-link">(ba.)pulse_countdown</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulse_countup_loop" class="nav-link">(ba.)pulse_countup_loop</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapulse_countdown_loop" class="nav-link">(ba.)pulse_countdown_loop</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baresetctr" class="nav-link">(ba.)resetCtr</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#array-processingpattern-matching" class="nav-link">Array Processing/Pattern Matching</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#bacount" class="nav-link">(ba.)count</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batake" class="nav-link">(ba.)take</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#basubseq" class="nav-link">(ba.)subseq</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#function-tabulation" class="nav-link">Function tabulation</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#batabulate" class="nav-link">(ba.)tabulate</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batabulate_chebychev" class="nav-link">(ba.)tabulate_chebychev</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#selectors-conditions" class="nav-link">Selectors (Conditions)</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#baif" class="nav-link">(ba.)if</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baselector" class="nav-link">(ba.)selector</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baselect2stereo" class="nav-link">(ba.)select2stereo</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baselectn" class="nav-link">(ba.)selectn</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baselectmulti" class="nav-link">(ba.)selectmulti</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baselectoutn" class="nav-link">(ba.)selectoutn</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#other" class="nav-link">Other</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#balatch" class="nav-link">(ba.)latch</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#basandh" class="nav-link">(ba.)sAndH</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#badownsample" class="nav-link">(ba.)downSample</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapeakhold" class="nav-link">(ba.)peakhold</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#bapeakholder" class="nav-link">(ba.)peakholder</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baimpulsify" class="nav-link">(ba.)impulsify</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baautomat" class="nav-link">(ba.)automat</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babpf" class="nav-link">(ba.)bpf</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#balistinterp" class="nav-link">(ba.)listInterp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babypass1" class="nav-link">(ba.)bypass1</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babypass2" class="nav-link">(ba.)bypass2</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babypass1to2" class="nav-link">(ba.)bypass1to2</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babypass_fade" class="nav-link">(ba.)bypass_fade</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#batoggle" class="nav-link">(ba.)toggle</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baon_and_off" class="nav-link">(ba.)on_and_off</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#babitcrusher" class="nav-link">(ba.)bitcrusher</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#sliding-reduce" class="nav-link">Sliding Reduce</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#baslidingreduce" class="nav-link">(ba.)slidingReduce</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingsum" class="nav-link">(ba.)slidingSum</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingsump" class="nav-link">(ba.)slidingSump</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingmax" class="nav-link">(ba.)slidingMax</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingmin" class="nav-link">(ba.)slidingMin</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingmean" class="nav-link">(ba.)slidingMean</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingmeanp" class="nav-link">(ba.)slidingMeanp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingrms" class="nav-link">(ba.)slidingRMS</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baslidingrmsp" class="nav-link">(ba.)slidingRMSp</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#parallel-operators" class="nav-link">Parallel Operators</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#baparallelop" class="nav-link">(ba.)parallelOp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baparallelmax" class="nav-link">(ba.)parallelMax</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baparallelmin" class="nav-link">(ba.)parallelMin</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baparallelmean" class="nav-link">(ba.)parallelMean</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#baparallelrms" class="nav-link">(ba.)parallelRMS</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div></div>
<div class="col-md-9 main-container" role="main">
<h1 id="basicslib">basics.lib</h1>
<p>A library of basic elements. Its official prefix is <code>ba</code>.</p>
<h4 id="references">References</h4>
<ul>
<li><a href="https://github.com/grame-cncm/faustlibraries/blob/master/basics.lib">https://github.com/grame-cncm/faustlibraries/blob/master/basics.lib</a></li>
</ul>
<h2 id="conversion-tools">Conversion Tools</h2>
<hr />
<h3 id="basamp2sec"><code>(ba.)samp2sec</code></h3>
<p>Converts a number of samples to a duration in seconds at the current sampling rate (see <code>ma.SR</code>).
<code>samp2sec</code> is a standard Faust function.</p>
<h4 id="usage">Usage</h4>
<pre><code>samp2sec(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: number of samples</li>
</ul>
<hr />
<h3 id="basec2samp"><code>(ba.)sec2samp</code></h3>
<p>Converts a duration in seconds to a number of samples at the current sampling rate (see <code>ma.SR</code>).
<code>samp2sec</code> is a standard Faust function.</p>
<h4 id="usage_1">Usage</h4>
<pre><code>sec2samp(d) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>d</code>: duration in seconds</li>
</ul>
<hr />
<h3 id="badb2linear"><code>(ba.)db2linear</code></h3>
<p>Converts a loudness in dB to a linear gain (0-1).
<code>db2linear</code> is a standard Faust function.</p>
<h4 id="usage_2">Usage</h4>
<pre><code>db2linear(l) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>l</code>: loudness in dB</li>
</ul>
<hr />
<h3 id="balinear2db"><code>(ba.)linear2db</code></h3>
<p>Converts a linear gain (0-1) to a loudness in dB.
<code>linear2db</code> is a standard Faust function.</p>
<h4 id="usage_3">Usage</h4>
<pre><code>linear2db(g) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>g</code>: a linear gain</li>
</ul>
<hr />
<h3 id="balin2loggain"><code>(ba.)lin2LogGain</code></h3>
<p>Converts a linear gain (0-1) to a log gain (0-1).</p>
<h4 id="usage_4">Usage</h4>
<pre><code>lin2LogGain(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the linear gain</li>
</ul>
<hr />
<h3 id="balog2lingain"><code>(ba.)log2LinGain</code></h3>
<p>Converts a log gain (0-1) to a linear gain (0-1).</p>
<h4 id="usage_5">Usage</h4>
<pre><code>log2LinGain(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the log gain</li>
</ul>
<hr />
<h3 id="batau2pole"><code>(ba.)tau2pole</code></h3>
<p>Returns a real pole giving exponential decay.
Note that t60 (time to decay 60 dB) is ~6.91 time constants.
<code>tau2pole</code> is a standard Faust function.</p>
<h4 id="usage_6">Usage</h4>
<pre><code>_ : smooth(tau2pole(tau)) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>tau</code>: time-constant in seconds</li>
</ul>
<hr />
<h3 id="bapole2tau"><code>(ba.)pole2tau</code></h3>
<p>Returns the time-constant, in seconds, corresponding to the given real,
positive pole in (0-1).
<code>pole2tau</code> is a standard Faust function.</p>
<h4 id="usage_7">Usage</h4>
<pre><code>pole2tau(pole) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>pole</code>: the pole</li>
</ul>
<hr />
<h3 id="bamidikey2hz"><code>(ba.)midikey2hz</code></h3>
<p>Converts a MIDI key number to a frequency in Hz (MIDI key 69 = A440).
<code>midikey2hz</code> is a standard Faust function.</p>
<h4 id="usage_8">Usage</h4>
<pre><code>midikey2hz(mk) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>mk</code>: the MIDI key number</li>
</ul>
<hr />
<h3 id="bahz2midikey"><code>(ba.)hz2midikey</code></h3>
<p>Converts a frequency in Hz to a MIDI key number (MIDI key 69 = A440).
<code>hz2midikey</code> is a standard Faust function.</p>
<h4 id="usage_9">Usage</h4>
<pre><code>hz2midikey(freq) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: frequency in Hz</li>
</ul>
<hr />
<h3 id="basemi2ratio"><code>(ba.)semi2ratio</code></h3>
<p>Converts semitones in a frequency multiplicative ratio.
<code>semi2ratio</code> is a standard Faust function.</p>
<h4 id="usage_10">Usage</h4>
<pre><code>semi2ratio(semi) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>semi</code>: number of semitone</li>
</ul>
<hr />
<h3 id="baratio2semi"><code>(ba.)ratio2semi</code></h3>
<p>Converts a frequency multiplicative ratio in semitones.
<code>ratio2semi</code> is a standard Faust function.</p>
<h4 id="usage_11">Usage</h4>
<pre><code>ratio2semi(ratio) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>ratio</code>: frequency multiplicative ratio</li>
</ul>
<hr />
<h3 id="bacent2ratio"><code>(ba.)cent2ratio</code></h3>
<p>Converts cents in a frequency multiplicative ratio.</p>
<h4 id="usage_12">Usage</h4>
<pre><code>cent2ratio(cent) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>cent</code>: number of cents</li>
</ul>
<hr />
<h3 id="baratio2cent"><code>(ba.)ratio2cent</code></h3>
<p>Converts a frequency multiplicative ratio in cents.</p>
<h4 id="usage_13">Usage</h4>
<pre><code>ratio2cent(ratio) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>ratio</code>: frequency multiplicative ratio</li>
</ul>
<hr />
<h3 id="bapianokey2hz"><code>(ba.)pianokey2hz</code></h3>
<p>Converts a piano key number to a frequency in Hz (piano key 49 = A440).</p>
<h4 id="usage_14">Usage</h4>
<pre><code>pianokey2hz(pk) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>pk</code>: the piano key number</li>
</ul>
<hr />
<h3 id="bahz2pianokey"><code>(ba.)hz2pianokey</code></h3>
<p>Converts a frequency in Hz to a piano key number (piano key 49 = A440).</p>
<h4 id="usage_15">Usage</h4>
<pre><code>hz2pianokey(freq) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: frequency in Hz</li>
</ul>
<h2 id="counters-and-timetempo-tools">Counters and Time/Tempo Tools</h2>
<hr />
<h3 id="bacounter"><code>(ba.)counter</code></h3>
<p>Starts counting 0, 1, 2, 3..., and raise the current integer value
at each upfront of the trigger.</p>
<h4 id="usage_16">Usage</h4>
<pre><code>counter(trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>trig</code>: the trigger signal, each upfront will move the counter to the next integer</li>
</ul>
<hr />
<h3 id="bacountdown"><code>(ba.)countdown</code></h3>
<p>Starts counting down from n included to 0. While trig is 1 the output is n.
The countdown starts with the transition of trig from 1 to 0. At the end
of the countdown the output value will remain at 0 until the next trig.
<code>countdown</code> is a standard Faust function.</p>
<h4 id="usage_17">Usage</h4>
<pre><code>countdown(n,trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the starting point of the countdown</li>
<li><code>trig</code>: the trigger signal (1: start at <code>n</code>; 0: decrease until 0)</li>
</ul>
<hr />
<h3 id="bacountup"><code>(ba.)countup</code></h3>
<p>Starts counting up from 0 to n included. While trig is 1 the output is 0.
The countup starts with the transition of trig from 1 to 0. At the end
of the countup the output value will remain at n until the next trig.
<code>countup</code> is a standard Faust function.</p>
<h4 id="usage_18">Usage</h4>
<pre><code>countup(n,trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the maximum count value</li>
<li><code>trig</code>: the trigger signal (1: start at 0; 0: increase until <code>n</code>)</li>
</ul>
<hr />
<h3 id="basweep"><code>(ba.)sweep</code></h3>
<p>Counts from 0 to <code>period-1</code> repeatedly, generating a
sawtooth waveform, like <code>os.lf_rawsaw</code>,
starting at 1 when <code>run</code> transitions from 0 to 1.
Outputs zero while <code>run</code> is 0.</p>
<h4 id="usage_19">Usage</h4>
<pre><code>sweep(period,run) : _
</code></pre>
<hr />
<h3 id="batime"><code>(ba.)time</code></h3>
<p>A simple timer that counts every samples from the beginning of the process.
<code>time</code> is a standard Faust function.</p>
<h4 id="usage_20">Usage</h4>
<pre><code>time : _
</code></pre>
<hr />
<h3 id="baramp"><code>(ba.)ramp</code></h3>
<p>A linear ramp with a slope of '(+/-)1/n' samples to reach the next value.</p>
<h4 id="usage_21">Usage</h4>
<pre><code>_ : ramp(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: number of samples to increment/decrement the value by one</li>
</ul>
<hr />
<h3 id="baline"><code>(ba.)line</code></h3>
<p>A linear ramp to reach a next value in 'n' samples.
Note that the interpolation process is restarted every time
the desired output value changes, the interpolation time is sampled only then.</p>
<h4 id="usage_22">Usage</h4>
<pre><code>_ : line(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: number of samples to reach the next value</li>
</ul>
<hr />
<h3 id="batempo"><code>(ba.)tempo</code></h3>
<p>Converts a tempo in BPM into a number of samples.</p>
<h4 id="usage_23">Usage</h4>
<pre><code>tempo(t) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>t</code>: tempo in BPM</li>
</ul>
<hr />
<h3 id="baperiod"><code>(ba.)period</code></h3>
<p>Basic sawtooth wave of period <code>p</code>.</p>
<h4 id="usage_24">Usage</h4>
<pre><code>period(p) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>p</code>: period as a number of samples</li>
</ul>
<hr />
<h3 id="bapulse"><code>(ba.)pulse</code></h3>
<p>Pulses (like 10000) generated at period <code>p</code>.</p>
<h4 id="usage_25">Usage</h4>
<pre><code>pulse(p) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>p</code>: period as a number of samples</li>
</ul>
<hr />
<h3 id="bapulsen"><code>(ba.)pulsen</code></h3>
<p>Pulses (like 11110000) of length <code>n</code> generated at period <code>p</code>.</p>
<h4 id="usage_26">Usage</h4>
<pre><code>pulsen(n,p) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: pulse length as a number of samples</li>
<li><code>p</code>: period as a number of samples</li>
</ul>
<hr />
<h3 id="bacycle"><code>(ba.)cycle</code></h3>
<p>Split nonzero input values into <code>n</code> cycles.</p>
<h4 id="usage_27">Usage</h4>
<pre><code>_ : cycle(n) : si.bus(n)
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of cycles/output signals</li>
</ul>
<hr />
<h3 id="babeat"><code>(ba.)beat</code></h3>
<p>Pulses at tempo <code>t</code>.
<code>beat</code> is a standard Faust function.</p>
<h4 id="usage_28">Usage</h4>
<pre><code>beat(t) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>t</code>: tempo in BPM</li>
</ul>
<hr />
<h3 id="bapulse_countup"><code>(ba.)pulse_countup</code></h3>
<p>Starts counting up pulses. While trig is 1 the output is
counting up, while trig is 0 the counter is reset to 0.</p>
<h4 id="usage_29">Usage</h4>
<pre><code>_ : pulse_countup(trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>trig</code>: the trigger signal (1: start at next pulse; 0: reset to 0)</li>
</ul>
<hr />
<h3 id="bapulse_countdown"><code>(ba.)pulse_countdown</code></h3>
<p>Starts counting down pulses. While trig is 1 the output is
counting down, while trig is 0 the counter is reset to 0.</p>
<h4 id="usage_30">Usage</h4>
<pre><code>_ : pulse_countdown(trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>trig</code>: the trigger signal (1: start at next pulse; 0: reset to 0)</li>
</ul>
<hr />
<h3 id="bapulse_countup_loop"><code>(ba.)pulse_countup_loop</code></h3>
<p>Starts counting up pulses from 0 to n included. While trig is 1 the output is
counting up, while trig is 0 the counter is reset to 0. At the end
of the countup (n) the output value will be reset to 0.</p>
<h4 id="usage_31">Usage</h4>
<pre><code>_ : pulse_countup_loop(n,trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the highest number of the countup (included) before reset to 0</li>
<li><code>trig</code>: the trigger signal (1: start at next pulse; 0: reset to 0)</li>
</ul>
<hr />
<h3 id="bapulse_countdown_loop"><code>(ba.)pulse_countdown_loop</code></h3>
<p>Starts counting down pulses from 0 to n included. While trig is 1 the output
is counting down, while trig is 0 the counter is reset to 0. At the end
of the countdown(n) the output value will be reset to 0.</p>
<h4 id="usage_32">Usage</h4>
<pre><code>_ : pulse_countdown_loop(n,trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the highest number of the countup (included) before reset to 0</li>
<li><code>trig</code>: the trigger signal (1: start at next pulse; 0: reset to 0)</li>
</ul>
<hr />
<h3 id="baresetctr"><code>(ba.)resetCtr</code></h3>
<p>Function that lets through the mth impulse out of
each consecutive group of <code>n</code> impulses.</p>
<h4 id="usage_33">Usage</h4>
<pre><code>_ : resetCtr(n,m) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the total number of impulses being split</li>
<li><code>m</code>: index of impulse to allow to be output</li>
</ul>
<h2 id="array-processingpattern-matching">Array Processing/Pattern Matching</h2>
<hr />
<h3 id="bacount"><code>(ba.)count</code></h3>
<p>Count the number of elements of list l.
<code>count</code> is a standard Faust function.</p>
<h4 id="usage_34">Usage</h4>
<pre><code>count(l)
count((10,20,30,40)) -> 4
</code></pre>
<p>Where:</p>
<ul>
<li><code>l</code>: list of elements</li>
</ul>
<hr />
<h3 id="batake"><code>(ba.)take</code></h3>
<p>Take an element from a list.
<code>take</code> is a standard Faust function.</p>
<h4 id="usage_35">Usage</h4>
<pre><code>take(P,l)
take(3,(10,20,30,40)) -> 30
</code></pre>
<p>Where:</p>
<ul>
<li><code>P</code>: position (int, known at compile time, P > 0)</li>
<li><code>l</code>: list of elements</li>
</ul>
<hr />
<h3 id="basubseq"><code>(ba.)subseq</code></h3>
<p>Extract a part of a list.</p>
<h4 id="usage_36">Usage</h4>
<pre><code>subseq(l, P, N)
subseq((10,20,30,40,50,60), 1, 3) -> (20,30,40)
subseq((10,20,30,40,50,60), 4, 1) -> 50
</code></pre>
<p>Where:</p>
<ul>
<li><code>l</code>: list</li>
<li><code>P</code>: start point (int, known at compile time, 0: begin of list)</li>
<li><code>N</code>: number of elements (int, known at compile time)</li>
</ul>
<h4 id="note">Note:</h4>
<p>Faust doesn't have proper lists. Lists are simulated with parallel
compositions and there is no empty list.</p>
<h2 id="function-tabulation">Function tabulation</h2>
<p>The purpose of function tabulation is to speed up the computation of heavy functions over an interval,
so that the computation at runtime can be faster than directly using the function.
Two techniques are implemented: </p>
<ul>
<li>
<p><code>tabulate</code> computes the function in a table and read the points using interpolation</p>
</li>
<li>
<p><code>tabulate_chebychev</code> uses Chebyshev polynomial approximation</p>
</li>
</ul>
<h4 id="comparison-program-example">Comparison program example</h4>
<pre><code>process = line(50000, r0, r1) <: FX-tb,FX-ch : par(i, 2, maxerr)
with {
C = 0;
FX = sin;
NX = 50;
CD = 3;
r0 = 0;
r1 = ma.PI;
tb(x) = ba.tabulate(C, FX, NX*(CD+1), r0, r1, x).cub;
ch(x) = ba.tabulate_chebychev(C, FX, NX, CD, r0, r1, x);
maxerr = abs : max ~ _;
line(n, x0, x1) = x0 + (ba.time%n)/n * (x1-x0);
};
</code></pre>
<hr />
<h3 id="batabulate"><code>(ba.)tabulate</code></h3>
<p>Tabulate a 1D function over the range [r0, r1] for access via nearest-value, linear, cubic interpolation.
In other words, the uniformly tabulated function can be evaluated using interpolation of order 0 (none), 1 (linear), or 3 (cubic).</p>
<h4 id="usage_37">Usage</h4>
<pre><code>tabulate(C, FX, S, r0, r1, x).(val|lin|cub) : _
</code></pre>
<ul>
<li><code>C</code>: whether to dynamically force the <code>x</code> value to the range [r0, r1]: 1 forces the check, 0 deactivates it (constant numerical expression)</li>
<li><code>FX</code>: unary function Y=F(X) with one output (scalar function of one variable) </li>
<li><code>S</code>: size of the table in samples (constant numerical expression)</li>
<li><code>r0</code>: minimum value of argument x</li>
<li><code>r1</code>: maximum value of argument x</li>
</ul>
<pre><code>tabulate(C, FX, S, r0, r1, x).val uses the value in the table closest to x
</code></pre>
<pre><code>tabulate(C, FX, S, r0, r1, x).lin evaluates at x using linear interpolation between the closest stored values
</code></pre>
<pre><code>tabulate(C, FX, S, r0, r1, x).cub evaluates at x using cubic interpolation between the closest stored values
</code></pre>
<h4 id="example-test-program">Example test program</h4>
<pre><code>midikey2hz(mk) = ba.tabulate(1, ba.midikey2hz, 512, 0, 127, mk).lin;
process = midikey2hz(ba.time), ba.midikey2hz(ba.time);
</code></pre>
<hr />
<h3 id="batabulate_chebychev"><code>(ba.)tabulate_chebychev</code></h3>
<p>Tabulate a 1D function over the range [r0, r1] for access via Chebyshev polynomial approximation.
In contrast to <code>(ba.)tabulate</code>, which interpolates only between tabulated samples, <code>(ba.)tabulate_chebychev</code>
stores coefficients of Chebyshev polynomials that are evaluated to provide better approximations in many cases.
Two new arguments controlling this are NX, the number of segments into which [r0, r1] is divided, and CD,
the maximum Chebyshev polynomial degree to use for each segment. A <code>rdtable</code> of size NX*(CD+1) is internally used.</p>
<p>Note that processing <code>r1</code> the last point in the interval is not safe. So either be sure the input stays in [r0, r1[
or use <code>C = 1</code>.</p>
<h4 id="usage_38">Usage</h4>
<pre><code>_ : tabulate_chebychev(C, FX, NX, CD, r0, r1) : _
</code></pre>
<ul>
<li><code>C</code>: whether to dynamically force the value to the range [r0, r1]: 1 forces the check, 0 deactivates it (constant numerical expression)</li>
<li><code>FX</code>: unary function Y=F(X) with one output (scalar function of one variable)</li>
<li><code>NX</code>: number of segments for uniformly partitioning [r0, r1] (constant numerical expression)</li>
<li><code>CD</code>: maximum polynomial degree for each Chebyshev polynomial (constant numerical expression)</li>
<li><code>r0</code>: minimum value of argument x</li>
<li><code>r1</code>: maximum value of argument x</li>
</ul>
<h4 id="example-test-program_1">Example test program</h4>
<pre><code>midikey2hz_chebychev(mk) = ba.tabulate_chebychev(1, ba.midikey2hz, 100, 4, 0, 127, mk);
process = midikey2hz_chebychev(ba.time), ba.midikey2hz(ba.time);
</code></pre>
<h2 id="selectors-conditions">Selectors (Conditions)</h2>
<hr />
<h3 id="baif"><code>(ba.)if</code></h3>
<p>if-then-else implemented with a select2. WARNING: since <code>select2</code> is strict (always evaluating both branches),
the resulting if does not have the usual "lazy" semantic of the C if form, and thus cannot be used to
protect against forbidden computations like division-by-zero for instance.</p>
<h4 id="usage_39">Usage</h4>
<ul>
<li><code>if(cond, then, else) : _</code></li>
</ul>
<p>Where:</p>
<ul>
<li><code>cond</code>: condition</li>
<li><code>then</code>: signal selected while cond is true</li>
<li><code>else</code>: signal selected while cond is false</li>
</ul>
<hr />
<h3 id="baselector"><code>(ba.)selector</code></h3>
<p>Selects the ith input among n at compile time.</p>
<h4 id="usage_40">Usage</h4>
<pre><code>selector(I,N)
_,_,_,_ : selector(2,4) : _ // selects the 3rd input among 4
</code></pre>
<p>Where:</p>
<ul>
<li><code>I</code>: input to select (int, numbered from 0, known at compile time)</li>
<li><code>N</code>: number of inputs (int, known at compile time, N > I)</li>
</ul>
<p>There is also cselector for selecting among complex input signals of the form (real,imag).</p>
<hr />
<h3 id="baselect2stereo"><code>(ba.)select2stereo</code></h3>
<p>Select between 2 stereo signals.</p>
<h4 id="usage_41">Usage</h4>
<pre><code>_,_,_,_ : select2stereo(bpc) : _,_
</code></pre>
<p>Where:</p>
<ul>
<li><code>bpc</code>: the selector switch (0/1)</li>
</ul>
<hr />
<h3 id="baselectn"><code>(ba.)selectn</code></h3>
<p>Selects the ith input among N at run time.</p>
<h4 id="usage_42">Usage</h4>
<pre><code>selectn(N,i)
_,_,_,_ : selectn(4,2) : _ // selects the 3rd input among 4
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: number of inputs (int, known at compile time, N > 0)</li>
<li><code>i</code>: input to select (int, numbered from 0)</li>
</ul>
<h4 id="example-test-program_2">Example test program</h4>
<pre><code>N = 64;
process = par(n, N, (par(i,N,i) : selectn(N,n)));
</code></pre>
<hr />
<h3 id="baselectmulti"><code>(ba.)selectmulti</code></h3>
<p>Selects the ith circuit among N at run time (all should have the same number of inputs and outputs)
with a crossfade.</p>
<h4 id="usage_43">Usage</h4>
<pre><code>selectmulti(n,lgen,id)
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: crossfade in samples</li>
<li><code>lgen</code>: list of circuits</li>
<li><code>id</code>: circuit to select (int, numbered from 0)</li>
</ul>
<h4 id="example-test-program_3">Example test program</h4>
<pre><code>process = selectmulti(ma.SR/10, ((3,9),(2,8),(5,7)), nentry("choice", 0, 0, 2, 1));
process = selectmulti(ma.SR/10, ((_*3,_*9),(_*2,_*8),(_*5,_*7)), nentry("choice", 0, 0, 2, 1));
</code></pre>
<hr />
<h3 id="baselectoutn"><code>(ba.)selectoutn</code></h3>
<p>Route input to the output among N at run time.</p>
<h4 id="usage_44">Usage</h4>
<pre><code>_ : selectoutn(N, i) : si.bus(N)
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: number of outputs (int, known at compile time, N > 0)</li>
<li><code>i</code>: output number to route to (int, numbered from 0) (i.e. slider)</li>
</ul>
<h4 id="example-test-program_4">Example test program</h4>
<pre><code>process = 1 : selectoutn(3, sel) : par(i, 3, vbargraph("v.bargraph %i", 0, 1));
sel = hslider("volume", 0, 0, 2, 1) : int;
</code></pre>
<h2 id="other">Other</h2>
<hr />
<h3 id="balatch"><code>(ba.)latch</code></h3>
<p>Latch input on positive-going transition of trig:"records" the input when trig
switches from 0 to 1, outputs a frozen values everytime else.</p>
<h4 id="usage_45">Usage</h4>
<pre><code>_ : latch(trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>trig</code>: hold trigger (0 for hold, 1 for bypass)</li>
</ul>
<hr />
<h3 id="basandh"><code>(ba.)sAndH</code></h3>
<p>Sample And Hold: "records" the input when trig is 1, outputs a frozen value when trig is 0.
<code>sAndH</code> is a standard Faust function.</p>
<h4 id="usage_46">Usage</h4>
<pre><code>_ : sAndH(trig) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>trig</code>: hold trigger (0 for hold, 1 for bypass)</li>
</ul>
<hr />
<h3 id="badownsample"><code>(ba.)downSample</code></h3>
<p>Down sample a signal. WARNING: this function doesn't change the
rate of a signal, it just holds samples...
<code>downSample</code> is a standard Faust function.</p>
<h4 id="usage_47">Usage</h4>
<pre><code>_ : downSample(freq) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: new rate in Hz</li>
</ul>
<hr />
<h3 id="bapeakhold"><code>(ba.)peakhold</code></h3>
<p>Outputs current max value above zero.</p>
<h4 id="usage_48">Usage</h4>
<pre><code>_ : peakhold(mode) : _
</code></pre>
<p>Where:</p>
<p><code>mode</code> means:
0 - Pass through. A single sample 0 trigger will work as a reset.
1 - Track and hold max value.</p>
<hr />
<h3 id="bapeakholder"><code>(ba.)peakholder</code></h3>
<p>While peak-holder functions are scarcely discussed in the literature
(please do send me an email if you know otherwise), common sense
tells that the expected behaviour should be as follows: the absolute
value of the input signal is compared with the output of the peak-holder;
if the input is greater or equal to the output, a new peak is detected
and sent to the output; otherwise, a timer starts and the current peak
is held for N samples; once the timer is out and no new peaks have been
detected, the absolute value of the current input becomes the new peak.</p>
<h4 id="usage_49">Usage</h4>
<pre><code>_ : peakholder(holdTime) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>holdTime</code>: hold time in samples</li>
</ul>
<hr />
<h3 id="baimpulsify"><code>(ba.)impulsify</code></h3>
<p>Turns a signal into an impulse with the value of the current sample
(0.3,0.2,0.1 becomes 0.3,0.0,0.0). This function is typically used with a
<code>button</code> to turn its output into an impulse. <code>impulsify</code> is a standard Faust
function.</p>
<h4 id="usage_50">Usage</h4>
<pre><code>button("gate") : impulsify;
</code></pre>
<hr />
<h3 id="baautomat"><code>(ba.)automat</code></h3>
<p>Record and replay in a loop the successives values of the input signal.</p>
<h4 id="usage_51">Usage</h4>
<pre><code>hslider(...) : automat(t, size, init) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>t</code>: tempo in BPM</li>
<li><code>size</code>: number of items in the loop</li>
<li><code>init</code>: init value in the loop</li>
</ul>
<hr />
<h3 id="babpf"><code>(ba.)bpf</code></h3>
<p>bpf is an environment (a group of related definitions) that can be used to
create break-point functions. It contains three functions:</p>
<ul>
<li><code>start(x,y)</code> to start a break-point function</li>
<li><code>end(x,y)</code> to end a break-point function</li>
<li><code>point(x,y)</code> to add intermediate points to a break-point function</li>
</ul>
<p>A minimal break-point function must contain at least a start and an end point:</p>
<pre><code>f = bpf.start(x0,y0) : bpf.end(x1,y1);
</code></pre>
<p>A more involved break-point function can contains any number of intermediate
points:</p>
<pre><code>f = bpf.start(x0,y0) : bpf.point(x1,y1) : bpf.point(x2,y2) : bpf.end(x3,y3);
</code></pre>
<p>In any case the <code>x_{i}</code> must be in increasing order (for all <code>i</code>, <code>x_{i} < x_{i+1}</code>).
For example the following definition:</p>
<pre><code>f = bpf.start(x0,y0) : ... : bpf.point(xi,yi) : ... : bpf.end(xn,yn);
</code></pre>
<p>implements a break-point function f such that:</p>
<ul>
<li><code>f(x) = y_{0}</code> when <code>x < x_{0}</code></li>
<li><code>f(x) = y_{n}</code> when <code>x > x_{n}</code></li>
<li><code>f(x) = y_{i} + (y_{i+1}-y_{i})*(x-x_{i})/(x_{i+1}-x_{i})</code> when <code>x_{i} <= x</code>
and <code>x < x_{i+1}</code></li>
</ul>
<p><code>bpf</code> is a standard Faust function.</p>
<hr />
<h3 id="balistinterp"><code>(ba.)listInterp</code></h3>
<p>Linearly interpolates between the elements of a list.</p>
<h4 id="usage_52">Usage</h4>
<pre><code>index = 1.69; // range is 0-4
process = listInterp((800,400,350,450,325),index);
</code></pre>
<p>Where:</p>
<ul>
<li><code>index</code>: the index (float) to interpolate between the different values.
The range of <code>index</code> depends on the size of the list.</li>
</ul>
<hr />
<h3 id="babypass1"><code>(ba.)bypass1</code></h3>
<p>Takes a mono input signal, route it to <code>e</code> and bypass it if <code>bpc = 1</code>.
When bypassed, <code>e</code> is feed with zeros so that its state is cleanup up.
<code>bypass1</code> is a standard Faust function.</p>
<h4 id="usage_53">Usage</h4>
<pre><code>_ : bypass1(bpc,e) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>bpc</code>: bypass switch (0/1)</li>
<li><code>e</code>: a mono effect</li>
</ul>
<hr />
<h3 id="babypass2"><code>(ba.)bypass2</code></h3>
<p>Takes a stereo input signal, route it to <code>e</code> and bypass it if <code>bpc = 1</code>.
When bypassed, <code>e</code> is feed with zeros so that its state is cleanup up.
<code>bypass2</code> is a standard Faust function.</p>
<h4 id="usage_54">Usage</h4>
<pre><code>_,_ : bypass2(bpc,e) : _,_
</code></pre>
<p>Where:</p>
<ul>
<li><code>bpc</code>: bypass switch (0/1)</li>
<li><code>e</code>: a stereo effect</li>
</ul>
<hr />
<h3 id="babypass1to2"><code>(ba.)bypass1to2</code></h3>
<p>Bypass switch for effect <code>e</code> having mono input signal and stereo output.
Effect <code>e</code> is bypassed if <code>bpc = 1</code>.When bypassed, <code>e</code> is feed with zeros
so that its state is cleanup up.
<code>bypass1to2</code> is a standard Faust function.</p>
<h4 id="usage_55">Usage</h4>
<pre><code>_ : bypass1to2(bpc,e) : _,_
</code></pre>
<p>Where:</p>
<ul>
<li><code>bpc</code>: bypass switch (0/1)</li>
<li><code>e</code>: a mono-to-stereo effect</li>
</ul>
<hr />
<h3 id="babypass_fade"><code>(ba.)bypass_fade</code></h3>
<p>Bypass an arbitrary (N x N) circuit with 'n' samples crossfade.
Inputs and outputs signals are faded out when 'e' is bypassed,
so that 'e' state is cleanup up.
Once bypassed the effect is replaced by <code>par(i,N,_)</code>.
Bypassed circuits can be chained.</p>
<h4 id="usage_56">Usage</h4>
<pre><code>_ : bypass_fade(n,b,e) : _
or
_,_ : bypass_fade(n,b,e) : _,_
</code></pre>
<ul>
<li><code>n</code>: number of samples for the crossfade</li>
<li><code>b</code>: bypass switch (0/1)</li>
<li><code>e</code>: N x N circuit</li>
</ul>
<h4 id="example-test-program_5">Example test program</h4>
<pre><code>process = bypass_fade(ma.SR/10, checkbox("bypass echo"), echo);
process = bypass_fade(ma.SR/10, checkbox("bypass reverb"), freeverb);
</code></pre>
<hr />
<h3 id="batoggle"><code>(ba.)toggle</code></h3>
<p>Triggered by the change of 0 to 1, it toggles the output value
between 0 and 1.</p>
<h4 id="usage_57">Usage</h4>
<pre><code>_ : toggle : _
</code></pre>
<h4 id="example-test-program_6">Example test program</h4>
<pre><code>button("toggle") : toggle : vbargraph("output", 0, 1)
(an.amp_follower(0.1) > 0.01) : toggle : vbargraph("output", 0, 1) // takes audio input
</code></pre>
<hr />
<h3 id="baon_and_off"><code>(ba.)on_and_off</code></h3>
<p>The first channel set the output to 1, the second channel to 0.</p>
<h4 id="usage_58">Usage</h4>
<pre><code>_,_ : on_and_off : _
</code></pre>
<h4 id="example-test-program_7">Example test program</h4>
<pre><code>button("on"), button("off") : on_and_off : vbargraph("output", 0, 1)
</code></pre>
<hr />
<h3 id="babitcrusher"><code>(ba.)bitcrusher</code></h3>
<p>Produce distortion by reduction of the signal resolution.</p>
<h4 id="usage_59">Usage</h4>
<pre><code>_ : bitcrusher(nbits) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>nbits</code>: the number of bits of the wanted resolution</li>
</ul>
<h2 id="sliding-reduce">Sliding Reduce</h2>
<p>Provides various operations on the last n samples using a high order
<code>slidingReduce(op,n,maxN,disabledVal,x)</code> fold-like function:</p>
<ul>
<li><code>slidingSum(n)</code>: the sliding sum of the last n input samples, CPU-light</li>
<li><code>slidingSump(n,maxN)</code>: the sliding sum of the last n input samples, numerically stable "forever"</li>
<li><code>slidingMax(n,maxN)</code>: the sliding max of the last n input samples</li>
<li><code>slidingMin(n,maxN)</code>: the sliding min of the last n input samples</li>
<li><code>slidingMean(n)</code>: the sliding mean of the last n input samples, CPU-light</li>
<li><code>slidingMeanp(n,maxN)</code>: the sliding mean of the last n input samples, numerically stable "forever"</li>
<li><code>slidingRMS(n)</code>: the sliding RMS of the last n input samples, CPU-light</li>
<li><code>slidingRMSp(n,maxN)</code>: the sliding RMS of the last n input samples, numerically stable "forever"</li>
</ul>
<h4 id="working-principle">Working Principle</h4>
<p>If we want the maximum of the last 8 values, we can do that as:</p>
<pre><code>simpleMax(x) =
(
(
max(x@0,x@1),
max(x@2,x@3)
) :max
),
(
(
max(x@4,x@5),
max(x@6,x@7)
) :max
)
:max;
</code></pre>
<p><code>max(x@2,x@3)</code> is the same as <code>max(x@0,x@1)@2</code> but the latter re-uses a
value we already computed,so is more efficient. Using the same trick for
values 4 trough 7, we can write:</p>
<pre><code>efficientMax(x)=
(
(
max(x@0,x@1),
max(x@0,x@1)@2
) :max
),
(
(
max(x@0,x@1),
max(x@0,x@1)@2
) :max@4
)
:max;
</code></pre>
<p>We can rewrite it recursively, so it becomes possible to get the maximum at
have any number of values, as long as it's a power of 2.</p>
<pre><code>recursiveMax =
case {
(1,x) => x;
(N,x) => max(recursiveMax(N/2,x), recursiveMax(N/2,x)@(N/2));
};
</code></pre>
<p>What if we want to look at a number of values that's not a power of 2?
For each value, we will have to decide whether to use it or not.
If n is bigger than the index of the value, we use it, otherwise we replace
it with (<code>0-(ma.MAX)</code>):</p>
<pre><code>variableMax(n,x) =
max(
max(
(
(x@0 : useVal(0)),
(x@1 : useVal(1))
):max,
(
(x@2 : useVal(2)),
(x@3 : useVal(3))
):max
),
max(
(
(x@4 : useVal(4)),
(x@5 : useVal(5))
):max,
(
(x@6 : useVal(6)),
(x@7 : useVal(7))
):max
)
)
with {
useVal(i) = select2((n>=i) , (0-(ma.MAX)),_);
};
</code></pre>
<p>Now it becomes impossible to re-use any values. To fix that let's first look
at how we'd implement it using recursiveMax, but with a fixed n that is not
a power of 2. For example, this is how you'd do it with <code>n=3</code>:</p>
<pre><code>binaryMaxThree(x) =
(
recursiveMax(1,x)@0, // the first x
recursiveMax(2,x)@1 // the second and third x
):max;
</code></pre>
<p><code>n=6</code></p>
<pre><code>binaryMaxSix(x) =
(
recursiveMax(2,x)@0, // first two
recursiveMax(4,x)@2 // third trough sixth
):max;
</code></pre>
<p>Note that <code>recursiveMax(2,x)</code> is used at a different delay then in
<code>binaryMaxThree</code>, since it represents 1 and 2, not 2 and 3. Each block is
delayed the combined size of the previous blocks.</p>
<p><code>n=7</code></p>
<pre><code>binaryMaxSeven(x) =
(
(
recursiveMax(1,x)@0, // first x
recursiveMax(2,x)@1 // second and third
):max,
(
recursiveMax(4,x)@3 // fourth trough seventh
)
):max;
</code></pre>
<p>To make a variable version, we need to know which powers of two are used,
and at which delay time.</p>
<p>Then it becomes a matter of:</p>
<ul>
<li>lining up all the different block sizes in parallel: <code>sequentialOperatorParOut()</code></li>
<li>delaying each the appropriate amount: <code>sumOfPrevBlockSizes()</code></li>
<li>turning it on or off: <code>useVal()</code></li>
<li>getting the maximum of all of them: <code>parallelOp()</code></li>
</ul>
<p>In Faust, we can only do that for a fixed maximum number of values: <code>maxN</code>, known at compile time.</p>
<hr />
<h3 id="baslidingreduce"><code>(ba.)slidingReduce</code></h3>
<p>Fold-like high order function. Apply a commutative binary operation <code>op</code> to
the last <code>n</code> consecutive samples of a signal <code>x</code>. For example :
<code>slidingReduce(max,128,128,0-(ma.MAX))</code> will compute the maximum of the last
128 samples. The output is updated each sample, unlike reduce, where the
output is constant for the duration of a block.</p>
<h4 id="usage_60">Usage</h4>
<pre><code>_ : slidingReduce(op,n,maxN,disabledVal) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
<li><code>op</code>: the operator. Needs to be a commutative one.</li>
<li><code>disabledVal</code>: the value to use when we want to ignore a value.</li>
</ul>
<p>In other words, <code>op(x,disabledVal)</code> should equal to <code>x</code>. For example,
<code>+(x,0)</code> equals <code>x</code> and <code>min(x,ma.MAX)</code> equals <code>x</code>. So if we want to
calculate the sum, we need to give 0 as <code>disabledVal</code>, and if we want the
minimum, we need to give <code>ma.MAX</code> as <code>disabledVal</code>.</p>
<hr />
<h3 id="baslidingsum"><code>(ba.)slidingSum</code></h3>
<p>The sliding sum of the last n input samples.</p>
<p>It will eventually run into numerical trouble when there is a persistent dc component.
If that matters in your application, use the more CPU-intensive <code>ba.slidingSump</code>.</p>
<h4 id="usage_61">Usage</h4>
<pre><code>_ : slidingSum(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
</ul>
<hr />
<h3 id="baslidingsump"><code>(ba.)slidingSump</code></h3>
<p>The sliding sum of the last n input samples.</p>
<p>It uses a lot more CPU than <code>ba.slidingSum</code>, but is numerically stable "forever" in return.</p>
<h4 id="usage_62">Usage</h4>
<pre><code>_ : slidingSump(n,maxN) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
</ul>
<hr />
<h3 id="baslidingmax"><code>(ba.)slidingMax</code></h3>
<p>The sliding maximum of the last n input samples.</p>
<h4 id="usage_63">Usage</h4>
<pre><code>_ : slidingMax(n,maxN) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
</ul>
<hr />
<h3 id="baslidingmin"><code>(ba.)slidingMin</code></h3>
<p>The sliding minimum of the last n input samples.</p>
<h4 id="usage_64">Usage</h4>
<pre><code>_ : slidingMin(n,maxN) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
</ul>
<hr />
<h3 id="baslidingmean"><code>(ba.)slidingMean</code></h3>
<p>The sliding mean of the last n input samples.</p>
<p>It will eventually run into numerical trouble when there is a persistent dc component.
If that matters in your application, use the more CPU-intensive <code>ba.slidingMeanp</code>.</p>
<h4 id="usage_65">Usage</h4>
<pre><code>_ : slidingMean(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
</ul>
<hr />
<h3 id="baslidingmeanp"><code>(ba.)slidingMeanp</code></h3>
<p>The sliding mean of the last n input samples.</p>
<p>It uses a lot more CPU than <code>ba.slidingMean</code>, but is numerically stable "forever" in return.</p>
<h4 id="usage_66">Usage</h4>
<pre><code>_ : slidingMeanp(n,maxN) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
</ul>
<hr />
<h3 id="baslidingrms"><code>(ba.)slidingRMS</code></h3>
<p>The root mean square of the last n input samples.</p>
<p>It will eventually run into numerical trouble when there is a persistent dc component.
If that matters in your application, use the more CPU-intensive <code>ba.slidingRMSp</code>.</p>
<h4 id="usage_67">Usage</h4>
<pre><code>_ : slidingRMS(n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
</ul>
<hr />
<h3 id="baslidingrmsp"><code>(ba.)slidingRMSp</code></h3>
<p>The root mean square of the last n input samples.</p>
<p>It uses a lot more CPU than <code>ba.slidingRMS</code>, but is numerically stable "forever" in return.</p>
<h4 id="usage_68">Usage</h4>
<pre><code>_ : slidingRMSp(n,maxN) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>n</code>: the number of values to process</li>
<li><code>maxN</code>: the maximum number of values to process (int, known at compile time, maxN > 0)</li>
</ul>
<h2 id="parallel-operators">Parallel Operators</h2>
<p>Provides various operations on N parallel inputs using a high order
<code>parallelOp(op,N,x)</code> function:</p>
<ul>
<li><code>parallelMax(N)</code>: the max of n parallel inputs</li>
<li><code>parallelMin(N)</code>: the min of n parallel inputs</li>
<li><code>parallelMean(N)</code>: the mean of n parallel inputs</li>
<li><code>parallelRMS(N)</code>: the RMS of n parallel inputs</li>
</ul>
<hr />
<h3 id="baparallelop"><code>(ba.)parallelOp</code></h3>
<p>Apply a commutative binary operation <code>op</code> to N parallel inputs.</p>
<h4 id="usage_69">usage</h4>
<pre><code>si.bus(N) : parallelOp(op,N) : _
</code></pre>
<p>where:</p>
<ul>
<li><code>N</code>: the number of parallel inputs known at compile time</li>
<li><code>op</code>: the operator which needs to be commutative</li>
</ul>
<hr />
<h3 id="baparallelmax"><code>(ba.)parallelMax</code></h3>
<p>The maximum of N parallel inputs.</p>
<h4 id="usage_70">Usage</h4>
<pre><code>si.bus(N) : parallelMax(N) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: the number of parallel inputs known at compile time</li>
</ul>
<hr />
<h3 id="baparallelmin"><code>(ba.)parallelMin</code></h3>
<p>The minimum of N parallel inputs.</p>
<h4 id="usage_71">Usage</h4>
<pre><code>si.bus(N) : parallelMin(N) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: the number of parallel inputs known at compile time</li>
</ul>
<hr />
<h3 id="baparallelmean"><code>(ba.)parallelMean</code></h3>
<p>The mean of N parallel inputs.</p>
<h4 id="usage_72">Usage</h4>
<pre><code>si.bus(N) : parallelMean(N) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: the number of parallel inputs known at compile time</li>
</ul>
<hr />
<h3 id="baparallelrms"><code>(ba.)parallelRMS</code></h3>
<p>The RMS of N parallel inputs.</p>
<h4 id="usage_73">Usage</h4>
<pre><code>si.bus(N) : parallelRMS(N) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: the number of parallel inputs known at compile time</li>
</ul></div>
</div>
</div>
<footer class="col-md-12">
<hr>
<p>Copyright © 2019-2022 <a href="https://www.grame.fr">Grame-CNCM</a></p>
</footer>
<script>
var base_url = "../..",
shortcuts = {"help": 191, "next": 78, "previous": 80, "search": 83};
</script>
<script src="../../js/base.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="../../search/main.js" defer></script>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="searchModalLabel">Search</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<p>
From here you can search these documents. Enter
your search terms below.
</p>
<form>
<div class="form-group">
<input type="search" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style="width: 20%;">Keys</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="help shortcut"><kbd>?</kbd></td>
<td>Open this help</td>
</tr>
<tr>
<td class="next shortcut"><kbd>n</kbd></td>
<td>Next page</td>
</tr>
<tr>
<td class="prev shortcut"><kbd>p</kbd></td>
<td>Previous page</td>
</tr>
<tr>
<td class="search shortcut"><kbd>s</kbd></td>
<td>Search</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
|