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
|
<!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> analyzers - 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="/usr/share/javascript/highlight.js/styles/github.css">
<link href="../../css/extra.css" rel="stylesheet">
<script src="../../js/jquery-3.6.0.min.js" defer></script>
<script src="../../js/bootstrap.min.js" defer></script>
<script src="/usr/share/javascript/highlight.js/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"> </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="./" class="dropdown-item active"> analyzers </a>
</li>
<li>
<a href="../basics/" class="dropdown-item"> 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="../linearalgebra/" class="dropdown-item"> linearalgebra </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="#analyzerslib" class="nav-link">analyzers.lib</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#amplitude-tracking" class="nav-link">Amplitude Tracking</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#anabs_envelope_rect" class="nav-link">(an.)abs_envelope_rect</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anabs_envelope_tau" class="nav-link">(an.)abs_envelope_tau</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anabs_envelope_t60" class="nav-link">(an.)abs_envelope_t60</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anabs_envelope_t19" class="nav-link">(an.)abs_envelope_t19</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anamp_follower" class="nav-link">(an.)amp_follower</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anamp_follower_ud" class="nav-link">(an.)amp_follower_ud</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anamp_follower_ar" class="nav-link">(an.)amp_follower_ar</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anms_envelope_rect" class="nav-link">(an.)ms_envelope_rect</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anms_envelope_tau" class="nav-link">(an.)ms_envelope_tau</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anms_envelope_t60" class="nav-link">(an.)ms_envelope_t60</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anms_envelope_t19" class="nav-link">(an.)ms_envelope_t19</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anrms_envelope_rect" class="nav-link">(an.)rms_envelope_rect</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anrms_envelope_tau" class="nav-link">(an.)rms_envelope_tau</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anrms_envelope_t60" class="nav-link">(an.)rms_envelope_t60</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anrms_envelope_t19" class="nav-link">(an.)rms_envelope_t19</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anzcr" class="nav-link">(an.)zcr</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#adaptive-frequency-analysis" class="nav-link">Adaptive Frequency Analysis</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#anpitchtracker" class="nav-link">(an.)pitchTracker</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anspectralcentroid" class="nav-link">(an.)spectralCentroid</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#spectrum-analyzers" class="nav-link">Spectrum-Analyzers</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#anmth_octave_analyzer" class="nav-link">(an.)mth_octave_analyzer</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#mth-octave-spectral-level" class="nav-link">Mth-Octave Spectral Level</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#anmth_octave_spectral_level6e" class="nav-link">(an.)mth_octave_spectral_level6e</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anthirdhalf_octave_analyzerfilterbank" class="nav-link">(an.)[third|half]_octave_[analyzer|filterbank]</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#arbritary-crossover-filter-banks-and-spectrum-analyzers" class="nav-link">Arbritary-Crossover Filter-Banks and Spectrum Analyzers</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#ananalyzer" class="nav-link">(an.)analyzer</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#fast-fourier-transform-fft-and-its-inverse-ifft" class="nav-link">Fast Fourier Transform (fft) and its Inverse (ifft)</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#angoertzelopt" class="nav-link">(an.)goertzelOpt</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#angoertzelcomp" class="nav-link">(an.)goertzelComp</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#angoertzel" class="nav-link">(an.)goertzel</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anfft" class="nav-link">(an.)fft</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#anifft" class="nav-link">(an.)ifft</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="analyzerslib">analyzers.lib</h1>
<p>Analyzers library. Its official prefix is <code>an</code>.</p>
<h4 id="references">References</h4>
<ul>
<li><a href="https://github.com/grame-cncm/faustlibraries/blob/master/analyzers.lib">https://github.com/grame-cncm/faustlibraries/blob/master/analyzers.lib</a></li>
</ul>
<h2 id="amplitude-tracking">Amplitude Tracking</h2>
<hr />
<h3 id="anabs_envelope_rect"><code>(an.)abs_envelope_rect</code></h3>
<p>Absolute value average with moving-average algorithm.</p>
<h4 id="usage">Usage</h4>
<pre><code>_ : abs_envelope_rect(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: sets the averaging frame in seconds</li>
</ul>
<hr />
<h3 id="anabs_envelope_tau"><code>(an.)abs_envelope_tau</code></h3>
<p>Absolute value average with one-pole lowpass and tau response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_1">Usage</h4>
<pre><code>_ : abs_envelope_tau(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anabs_envelope_t60"><code>(an.)abs_envelope_t60</code></h3>
<p>Absolute value average with one-pole lowpass and t60 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_2">Usage</h4>
<pre><code>_ : abs_envelope_t60(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 60 dB) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anabs_envelope_t19"><code>(an.)abs_envelope_t19</code></h3>
<p>Absolute value average with one-pole lowpass and t19 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_3">Usage</h4>
<pre><code>_ : abs_envelope_t19(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e^2.2) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anamp_follower"><code>(an.)amp_follower</code></h3>
<p>Classic analog audio envelope follower with infinitely fast rise and
exponential decay. The amplitude envelope instantaneously follows
the absolute value going up, but then floats down exponentially.</p>
<p><code>amp_follower</code> is a standard Faust function.</p>
<h4 id="usage_4">Usage</h4>
<pre><code>_ : amp_follower(rel) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>rel</code>: release time = amplitude-envelope time-constant (sec) going down</li>
</ul>
<h4 id="references_1">References</h4>
<ul>
<li>Musical Engineer's Handbook, Bernie Hutchins, Ithaca NY</li>
<li>1975 Electronotes Newsletter, Bernie Hutchins</li>
</ul>
<hr />
<h3 id="anamp_follower_ud"><code>(an.)amp_follower_ud</code></h3>
<p>Envelope follower with different up and down time-constants
(also called a "peak detector").</p>
<h4 id="usage_5">Usage</h4>
<pre><code> _ : amp_follower_ud(att,rel) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>att</code>: attack time = amplitude-envelope time constant (sec) going up</li>
<li><code>rel</code>: release time = amplitude-envelope time constant (sec) going down</li>
</ul>
<h4 id="note">Note</h4>
<p>We assume rel >> att. Otherwise, consider rel ~ max(rel,att).
For audio, att is normally faster (smaller) than rel (e.g., 0.001 and 0.01).
Use <code>amp_follower_ar</code> below to remove this restriction.</p>
<h4 id="reference">Reference</h4>
<ul>
<li>"Digital Dynamic Range Compressor Design --- A Tutorial and Analysis", by
Dimitrios Giannoulis, Michael Massberg, and Joshua D. Reiss</li>
<li><a href="https://www.eecs.qmul.ac.uk/~josh/documents/2012/GiannoulisMassbergReiss-dynamicrangecompression-JAES2012.pdf">https://www.eecs.qmul.ac.uk/~josh/documents/2012/GiannoulisMassbergReiss-dynamicrangecompression-JAES2012.pdf</a></li>
</ul>
<hr />
<h3 id="anamp_follower_ar"><code>(an.)amp_follower_ar</code></h3>
<p>Envelope follower with independent attack and release times. The
release can be shorter than the attack (unlike in <code>amp_follower_ud</code>
above).</p>
<h4 id="usage_6">Usage</h4>
<pre><code>_ : amp_follower_ar(att,rel) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>att</code>: attack time = amplitude-envelope time constant (sec) going up</li>
<li><code>rel</code>: release time = amplitude-envelope time constant (sec) going down</li>
</ul>
<hr />
<h3 id="anms_envelope_rect"><code>(an.)ms_envelope_rect</code></h3>
<p>Mean square with moving-average algorithm.</p>
<h4 id="usage_7">Usage</h4>
<pre><code>_ : ms_envelope_rect(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anms_envelope_tau"><code>(an.)ms_envelope_tau</code></h3>
<p>Mean square average with one-pole lowpass and tau response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_8">Usage</h4>
<pre><code>_ : ms_envelope_tau(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anms_envelope_t60"><code>(an.)ms_envelope_t60</code></h3>
<p>Mean square with one-pole lowpass and t60 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_9">Usage</h4>
<pre><code>_ : ms_envelope_t60(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 60 dB) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anms_envelope_t19"><code>(an.)ms_envelope_t19</code></h3>
<p>Mean square with one-pole lowpass and t19 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_10">Usage</h4>
<pre><code>_ : ms_envelope_t19(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e^2.2) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anrms_envelope_rect"><code>(an.)rms_envelope_rect</code></h3>
<p>Root mean square with moving-average algorithm.</p>
<h4 id="usage_11">Usage</h4>
<pre><code>_ : rms_envelope_rect(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anrms_envelope_tau"><code>(an.)rms_envelope_tau</code></h3>
<p>Root mean square with one-pole lowpass and tau response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_12">Usage</h4>
<pre><code>_ : rms_envelope_tau(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anrms_envelope_t60"><code>(an.)rms_envelope_t60</code></h3>
<p>Root mean square with one-pole lowpass and t60 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_13">Usage</h4>
<pre><code>_ : rms_envelope_t60(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 60 dB) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anrms_envelope_t19"><code>(an.)rms_envelope_t19</code></h3>
<p>Root mean square with one-pole lowpass and t19 response
(see <a href="https://faustlibraries.grame.fr/libs/filters/">filters.lib</a>).</p>
<h4 id="usage_14">Usage</h4>
<pre><code>_ : rms_envelope_t19(period) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>period</code>: (time to decay by 1/e^2.2) sets the averaging frame in secs</li>
</ul>
<hr />
<h3 id="anzcr"><code>(an.)zcr</code></h3>
<p>Zero-crossing rate (ZCR) with one-pole lowpass averaging based on the tau
constant. It outputs an index between 0 and 1 at a desired analysis frame.
The ZCR of a signal correlates with the noisiness [Gouyon et al. 2000] and
the spectral centroid [Herrera-Boyer et al. 2006] of a signal.
For sinusoidal signals, the ZCR can be multiplied by ma.SR/2 and used
as a frequency detector. For example, it can be deployed as a
computationally efficient adaptive mechanism for automatic Larsen
suppression.</p>
<h4 id="usage_15">Usage</h4>
<pre><code>_ : zcr(tau) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>tau</code>: (time to decay by e^-1) sets the averaging frame in seconds.</li>
</ul>
<h2 id="adaptive-frequency-analysis">Adaptive Frequency Analysis</h2>
<hr />
<h3 id="anpitchtracker"><code>(an.)pitchTracker</code></h3>
<p>This function implements a pitch-tracking algorithm by means of
zero-crossing rate analysis and adaptive low-pass filtering. The design
is based on the algorithm described in <a href="https://github.com/grame-cncm/faust/blob/master-dev/documentation/misc/Faust_tutorial2.pdf">this tutorial (section 2.2)</a>.</p>
<h4 id="usage_16">Usage</h4>
<pre><code>_ : pitchTracker(N, tau) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>N</code>: a constant numerical expression, sets the order of the low-pass filter, which
determines the sensitivity of the algorithm for signals where partials are
stronger than the fundamental frequency.</li>
<li><code>tau</code>: response time in seconds based on exponentially-weighted averaging with tau time-constant. See <a href="https://ccrma.stanford.edu/~jos/st/Exponentials.html">https://ccrma.stanford.edu/~jos/st/Exponentials.html</a>.</li>
</ul>
<hr />
<h3 id="anspectralcentroid"><code>(an.)spectralCentroid</code></h3>
<p>This function implements a time-domain spectral centroid by means of RMS
measurements and adaptive crossover filtering. The weight difference of the
upper and lower spectral powers are used to recursively adjust the crossover
cutoff so that the system (minimally) oscillates around a balancing point.</p>
<p>Unlike block processing techniques such as FFT, this algorithm provides
continuous measurements and fast response times. Furthermore, when providing
input signals that are spectrally sparse, the algorithm will output a
logarithmic measure of the centroid, which is perceptually desirable for
musical applications. For example, if the input signal is the combination
of three tones at 1000, 2000, and 4000 Hz, the centroid will be the middle
octave.</p>
<h4 id="usage_17">Usage</h4>
<pre><code>_ : spectralCentroid(nonlinearity, tau) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>nonlinearity</code>: a boolean to activate or deactivate nonlinear integration. The
nonlinear function is useful to improve stability with very short response times
such as .001 <= tau <= .005 , otherwise, the nonlinearity may reduce precision.</li>
<li><code>tau</code>: response time in seconds based on exponentially-weighted averaging with tau time-constant. See <a href="https://ccrma.stanford.edu/~jos/st/Exponentials.html">https://ccrma.stanford.edu/~jos/st/Exponentials.html</a>.</li>
</ul>
<h4 id="reference_1">Reference:</h4>
<p>Sanfilippo, D. (2021). Time-Domain Adaptive Algorithms for Low- and High-Level
Audio Information Processing. Computer Music Journal, 45(1), 24-38.</p>
<h4 id="example">Example:</h4>
<p><code>process = os.osc(500) + os.osc(1000) + os.osc(2000) + os.osc(4000) + os.osc(8000) : an.spectralCentroid(1, .001);</code></p>
<h2 id="spectrum-analyzers">Spectrum-Analyzers</h2>
<p>Spectrum-analyzers split the input signal into a bank of parallel signals, one for
each spectral band. They are related to the Mth-Octave Filter-Banks in <code>filters.lib</code>.
The documentation of this library contains more details about the implementation.
The parameters are:</p>
<ul>
<li><code>M</code>: number of band-slices per octave (>1)</li>
<li><code>N</code>: total number of bands (>2)</li>
<li><code>ftop</code> = upper bandlimit of the Mth-octave bands (<SR/2)</li>
</ul>
<p>In addition to the Mth-octave output signals, there is a highpass signal
containing frequencies from ftop to SR/2, and a "dc band" lowpass signal
containing frequencies from 0 (dc) up to the start of the Mth-octave bands.
Thus, the N output signals are:</p>
<pre><code>highpass(ftop), MthOctaveBands(M,N-2,ftop), dcBand(ftop*2^(-M*(N-1)))
</code></pre>
<p>A Spectrum-Analyzer is defined here as any band-split whose bands span
the relevant spectrum, but whose band-signals do not
necessarily sum to the original signal, either exactly or to within an
allpass filtering. Spectrum analyzer outputs are normally at least nearly
"power complementary", i.e., the power spectra of the individual bands
sum to the original power spectrum (to within some negligible tolerance).</p>
<h4 id="increasing-channel-isolation">Increasing Channel Isolation</h4>
<p>Go to higher filter orders - see Regalia et al. or Vaidyanathan (cited
below) regarding the construction of more aggressive recursive
filter-banks using elliptic or Chebyshev prototype filters.</p>
<h4 id="references_2">References</h4>
<ul>
<li>"Tree-structured complementary filter banks using all-pass sections",
Regalia et al., IEEE Trans. Circuits & Systems, CAS-34:1470-1484, Dec. 1987</li>
<li>"Multirate Systems and Filter Banks", P. Vaidyanathan, Prentice-Hall, 1993</li>
<li>Elementary filter theory: <a href="https://ccrma.stanford.edu/~jos/filters/">https://ccrma.stanford.edu/~jos/filters/</a></li>
</ul>
<hr />
<h3 id="anmth_octave_analyzer"><code>(an.)mth_octave_analyzer</code></h3>
<p>Octave analyzer.
<code>mth_octave_analyzer[N]</code> are standard Faust functions.</p>
<h4 id="usage_18">Usage</h4>
<pre><code>_ : mth_octave_analyzer(O,M,ftop,N) : par(i,N,_) // Oth-order Butterworth
_ : mth_octave_analyzer6e(M,ftop,N) : par(i,N,_) // 6th-order elliptic
</code></pre>
<p>Also for convenience:</p>
<pre><code>_ : mth_octave_analyzer3(M,ftop,N) : par(i,N,_) // 3d-order Butterworth
_ : mth_octave_analyzer5(M,ftop,N) : par(i,N,_) // 5th-order Butterworth
mth_octave_analyzer_default = mth_octave_analyzer6e;
</code></pre>
<p>Where:</p>
<ul>
<li><code>O</code>: (odd) order of filter used to split each frequency band into two</li>
<li><code>M</code>: number of band-slices per octave</li>
<li><code>ftop</code>: highest band-split crossover frequency (e.g., 20 kHz)</li>
<li><code>N</code>: total number of bands (including dc and Nyquist)</li>
</ul>
<h2 id="mth-octave-spectral-level">Mth-Octave Spectral Level</h2>
<p>Spectral Level: display (in bargraphs) the average signal level in each spectral band.</p>
<hr />
<h3 id="anmth_octave_spectral_level6e"><code>(an.)mth_octave_spectral_level6e</code></h3>
<p>Spectral level display.</p>
<h4 id="usage_19">Usage:</h4>
<pre><code>_ : mth_octave_spectral_level6e(M,ftop,NBands,tau,dB_offset) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>M</code>: bands per octave</li>
<li><code>ftop</code>: lower edge frequency of top band</li>
<li><code>NBands</code>: number of passbands (including highpass and dc bands),</li>
<li><code>tau</code>: spectral display averaging-time (time constant) in seconds,</li>
<li><code>dB_offset</code>: constant dB offset in all band level meters.</li>
</ul>
<p>Also for convenience:</p>
<pre><code>mth_octave_spectral_level_default = mth_octave_spectral_level6e;
spectral_level = mth_octave_spectral_level(2,10000,20);
</code></pre>
<hr />
<h3 id="anthirdhalf_octave_analyzerfilterbank"><code>(an.)[third|half]_octave_[analyzer|filterbank]</code></h3>
<p>A bunch of special cases based on the different analyzer functions described above:</p>
<pre><code>third_octave_analyzer(N) = mth_octave_analyzer_default(3,10000,N);
third_octave_filterbank(N) = mth_octave_filterbank_default(3,10000,N);
half_octave_analyzer(N) = mth_octave_analyzer_default(2,10000,N);
half_octave_filterbank(N) = mth_octave_filterbank_default(2,10000,N);
octave_filterbank(N) = mth_octave_filterbank_default(1,10000,N);
octave_analyzer(N) = mth_octave_analyzer_default(1,10000,N);
</code></pre>
<h4 id="usage_20">Usage</h4>
<p>See <code>mth_octave_spectral_level_demo</code> in <code>demos.lib</code>.</p>
<h2 id="arbritary-crossover-filter-banks-and-spectrum-analyzers">Arbritary-Crossover Filter-Banks and Spectrum Analyzers</h2>
<p>These are similar to the Mth-octave analyzers above, except that the
band-split frequencies are passed explicitly as arguments.</p>
<hr />
<h3 id="ananalyzer"><code>(an.)analyzer</code></h3>
<p>Analyzer.</p>
<h4 id="usage_21">Usage</h4>
<pre><code>_ : analyzer(O,freqs) : par(i,N,_) // No delay equalizer
</code></pre>
<p>Where:</p>
<ul>
<li><code>O</code>: band-split filter order (ODD integer required for filterbank[i])</li>
<li><code>freqs</code>: (fc1,fc2,...,fcNs) [in numerically ascending order], where
Ns=N-1 is the number of octave band-splits
(total number of bands N=Ns+1).</li>
</ul>
<p>If frequencies are listed explicitly as arguments, enclose them in parens:</p>
<pre><code>_ : analyzer(3,(fc1,fc2)) : _,_,_
</code></pre>
<h2 id="fast-fourier-transform-fft-and-its-inverse-ifft">Fast Fourier Transform (fft) and its Inverse (ifft)</h2>
<p>Sliding FFTs that compute a rectangularly windowed FFT each sample.</p>
<hr />
<h3 id="angoertzelopt"><code>(an.)goertzelOpt</code></h3>
<p>Optimized Goertzel filter. </p>
<h4 id="usage_22">Usage</h4>
<pre><code>_ : goertzelOpt(freq,n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: frequency to be analyzed</li>
<li><code>n</code>: the Goertzel block size</li>
</ul>
<h4 id="reference_2">Reference</h4>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Goertzel_algorithm">https://en.wikipedia.org/wiki/Goertzel_algorithm</a></li>
</ul>
<hr />
<h3 id="angoertzelcomp"><code>(an.)goertzelComp</code></h3>
<p>Complex Goertzel filter. </p>
<h4 id="usage_23">Usage</h4>
<pre><code>_ : goertzelComp(freq,n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: frequency to be analyzed</li>
<li><code>n</code>: the Goertzel block size</li>
</ul>
<h4 id="reference_3">Reference</h4>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Goertzel_algorithm">https://en.wikipedia.org/wiki/Goertzel_algorithm</a></li>
</ul>
<hr />
<h3 id="angoertzel"><code>(an.)goertzel</code></h3>
<p>Same as <a href="#goertzelopt"><code>goertzelOpt</code></a>. </p>
<h4 id="usage_24">Usage</h4>
<pre><code>_ : goertzel(freq,n) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>freq</code>: frequency to be analyzed</li>
<li><code>n</code>: the Goertzel block size</li>
</ul>
<h4 id="reference_4">Reference</h4>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Goertzel_algorithm">https://en.wikipedia.org/wiki/Goertzel_algorithm</a></li>
</ul>
<hr />
<h3 id="anfft"><code>(an.)fft</code></h3>
<p>Fast Fourier Transform (FFT).</p>
<h4 id="usage_25">Usage</h4>
<pre><code>si.cbus(N) : fft(N) : si.cbus(N)
</code></pre>
<p>Where:</p>
<ul>
<li><code>si.cbus(N)</code> is a bus of N complex signals, each specified by real and imaginary parts:
(r0,i0), (r1,i1), (r2,i2), ...</li>
<li><code>N</code> is the FFT size (must be a power of 2: 2,4,8,16,... known at compile time) </li>
<li><code>fft(N)</code> performs a length <code>N</code> FFT for complex signals (radix 2)</li>
<li>The output is a bank of N complex signals containing the complex spectrum over time:
(R0, I0), (R1,I1), ...</li>
<li>The dc component is (R0,I0), where I0=0 for real input signals.</li>
</ul>
<p>FFTs of Real Signals:</p>
<ul>
<li>To perform a sliding FFT over a real input signal, you can say</li>
</ul>
<pre><code>process = signal : an.rtocv(N) : an.fft(N);
</code></pre>
<p>where <code>an.rtocv</code> converts a real (scalar) signal to a complex vector signal having a zero imaginary part.</p>
<ul>
<li>
<p>See <code>an.rfft_analyzer_c</code> (in <code>analyzers.lib</code>) and related functions for more detailed usage examples.</p>
</li>
<li>
<p>Use <code>an.rfft_spectral_level(N,tau,dB_offset)</code> to display the power spectrum of a real signal.</p>
</li>
<li>
<p>See <code>dm.fft_spectral_level_demo(N)</code> in <code>demos.lib</code> for an example GUI driving <code>an.rfft_spectral_level()</code>.</p>
</li>
</ul>
<h4 id="reference_5">Reference</h4>
<ul>
<li><a href="https://cnx.org/contents/zmcmahhR@7/Decimation-in-time-DIT-Radix-2">Decimation-in-time (DIT) Radix-2 FFT</a></li>
</ul>
<hr />
<h3 id="anifft"><code>(an.)ifft</code></h3>
<p>Inverse Fast Fourier Transform (IFFT).</p>
<h4 id="usage_26">Usage</h4>
<pre><code>si.cbus(N) : ifft(N) : si.cbus(N)
</code></pre>
<p>Where:</p>
<ul>
<li>N is the IFFT size (power of 2)</li>
<li>Input is a complex spectrum represented as interleaved real and imaginary parts:
(R0, I0), (R1,I1), (R2,I2), ...</li>
<li>Output is a bank of N complex signals giving the complex signal in the time domain:
(r0, i0), (r1,i1), (r2,i2), ...</li>
</ul></div>
</div>
</div>
<footer class="col-md-12">
<hr>
<p>Copyright © 2019-2025 <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="/usr/share/javascript/mathjax/MathJax.js" 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" data-no-results-text="No results found"></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>
|