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
|
<!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> fds - 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="../analyzers/" class="dropdown-item"> 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="./" class="dropdown-item active"> 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="#fdslib" class="nav-link">fds.lib</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#sources" class="nav-link">Sources</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#model-construction" class="nav-link">Model Construction</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#fdmodel1d" class="nav-link">(fd.)model1D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdmodel2d" class="nav-link">(fd.)model2D</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#interpolation" class="nav-link">Interpolation</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#fdstairsinterp1d" class="nav-link">(fd.)stairsInterp1D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdstairsinterp2d" class="nav-link">(fd.)stairsInterp2D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdlininterp1d" class="nav-link">(fd.)linInterp1D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdlininterp2d" class="nav-link">(fd.)linInterp2D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdstairsinterp1dout" class="nav-link">(fd.)stairsInterp1DOut</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdstairsinterp2dout" class="nav-link">(fd.)stairsInterp2DOut</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdlininterp1dout" class="nav-link">(fd.)linInterp1DOut</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdstairsinterp2dout_1" class="nav-link">(fd.)stairsInterp2DOut</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#routing" class="nav-link">Routing</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#fdroute1d" class="nav-link">(fd.)route1D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdroute2d" class="nav-link">(fd.)route2D</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#scheme-operations" class="nav-link">Scheme Operations</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#fdschemepoint" class="nav-link">(fd.)schemePoint</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdbuildscheme1d" class="nav-link">(fd.)buildScheme1D</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdbuildscheme2d" class="nav-link">(fd.)buildScheme2D</a>
<ul class="nav flex-column">
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#interaction-models" class="nav-link">Interaction Models</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="3"><a href="#fdhammer" class="nav-link">(fd.)hammer</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="3"><a href="#fdbow" class="nav-link">(fd.)bow</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="fdslib">fds.lib</h1>
<p>This library allows to build linear, explicit finite difference schemes
physical models in 1 or 2 dimensions using an approach based on the cellular
automata formalism. Its official prefix is <code>fd</code>. </p>
<p>In order to use the library, one needs to discretize the linear partial
differential equation of the desired system both at boundaries and in-between
them, thus obtaining a set of explicit recursion relations. Each one
of these will provide, for each spatial point the scalar coefficients to be
multiplied by the states of the current and past neighbour points.</p>
<p>Coefficients need to be stacked in parallel in order to form a coefficients
matrix for each point in the mesh. It is necessary to provide one matrix for
coefficients matrices are defined, they need to be placed in parallel and
ordered following the desired mesh structure (i.e., coefficients for the top
left boundaries will come first, while bottom right boundaries will come
last), to form a <em>coefficients scheme</em>, which can be used with the library
functions.</p>
<h2 id="sources">Sources</h2>
<p>Here are listed some works on finite difference schemes and cellular
automata thet were the basis for the implementation of this library</p>
<ul>
<li>S. Bilbao, Numerical Sound Synthesis.Chichester, UK: John Wiley Sons,
Ltd, 2009</li>
<li>P. Narbel, "Qualitative and quantitative cellular automata from
differential equations," Lecture Notes in Computer Science, vol. 4173,
pp. 112–121, 10 2006</li>
<li>X.-S. Yang and Y. Young, Cellular Automata, PDEs, and Pattern Formation.
Chapman & Hall/CRC, 092005, ch. 18, pp. 271–282.</li>
</ul>
<h4 id="references">References</h4>
<ul>
<li><a href="https://github.com/grame-cncm/faustlibraries/blob/master/fds.lib">https://github.com/grame-cncm/faustlibraries/blob/master/fds.lib</a></li>
</ul>
<h2 id="model-construction">Model Construction</h2>
<p>Once the coefficients scheme is defined, the user can simply call one of
these functions to obtain a fully working physical model. They expect to
receive a force input signal for each mesh point and output the state of each
point. Interpolation operators can be used to drive external forces to the
desired points, and to get the signal only from a certain area of the mesh.</p>
<hr />
<h3 id="fdmodel1d"><code>(fd.)model1D</code></h3>
<p>This function can be used to obtain a physical model in 1 dimension.
Takes a force input signal for each point and outputs the state of each
point.</p>
<h4 id="usage">Usage</h4>
<pre><code>si.bus(points) : model1D(points,R,T,scheme) : si.bus(points)
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: size of the mesh in points</li>
<li><code>R</code>: neighbourhood radius, indicates how many side points are needed (i.e.
if R=1 the mesh depends on one point on the left and one on the right)</li>
<li><code>T</code>: time coefficient, indicates how much steps back in time are needed (i.
e. if T=1 the maximum delay needed for a neighbour state is 1 sample)</li>
<li><code>scheme</code>: coefficients scheme</li>
</ul>
<hr />
<h3 id="fdmodel2d"><code>(fd.)model2D</code></h3>
<p>This function can be used to obtain a physical model in 2 dimension.
Takes a force input signal for each point and outputs the state of each
point.
IMPORTANT: 2D models with more than 30x20 points might crash the c++
compiler. 2D models need to be compiled with the command line compiler,
the online one presents some issues.</p>
<h4 id="usage_1">Usage</h4>
<pre><code>si.bus(pointsX*pointsY) : model2D(pointsX,pointsY,R,T,scheme) :
si.bus(pointsX*pointsY)
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: horizontal size of the mesh in points</li>
<li><code>pointsY</code>: vertical size of the mesh in points</li>
<li><code>R</code>: neighbourhood radius, indicates how many side points are needed (i.e.
if R=1 the mesh depends on one point on the left and one on the right)</li>
<li><code>T</code>: time coefficient, indicates how much steps back in time are needed (i.
e. if T=1 the maximum delay needed for a neighbour state is 1 sample)</li>
<li><code>scheme</code>: coefficients scheme</li>
</ul>
<h2 id="interpolation">Interpolation</h2>
<p>Interpolation functions can be used to drive the input signals to the
correct mesh points, or to get the output signal from the
desired points. All the interpolation functions allow to change the
input/output points at run time. In general, all these functions get in
input a number of connections, and output the same number of connections,
where each signal is multiplied by zero except the ones specified by the
arguments.</p>
<hr />
<h3 id="fdstairsinterp1d"><code>(fd.)stairsInterp1D</code></h3>
<p>Stairs interpolator in 1 dimension. Takes a number of signals and outputs
the same number of signals, where each one is multiplied by zero except the
one specified by the argument. This can vary at run time (i.e. a slider),
but must be an integer.</p>
<h4 id="usage_2">Usage</h4>
<pre><code>si.bus(points) : stairsInterp1D(points,point) : si.bus(points)
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>point</code>: number of the desired nonzero signal</li>
</ul>
<hr />
<h3 id="fdstairsinterp2d"><code>(fd.)stairsInterp2D</code></h3>
<p>Stairs interpolator in 2 dimensions. Similar to the 1-D version.</p>
<h4 id="usage_3">Usage</h4>
<pre><code>si.bus(pointsX*pointsY) : stairsInterp2D(pointsX,pointsY,pointX,pointY) :
si.bus(pointsX*pointsY)
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>pointX</code>: horizontal index of the desired nonzero signal</li>
<li><code>pointY</code>: vertical index of the desired nonzero signal</li>
</ul>
<hr />
<h3 id="fdlininterp1d"><code>(fd.)linInterp1D</code></h3>
<p>Linear interpolator in 1 dimension. Takes a number of signals and outputs
the same number of signals, where each one is multiplied by zero except two
signals around a floating point index. This is essentially a Faust
implementation of the $J(x_i)$ operator, not scaled by the spatial step.
(see Stefan Bilbao's book, Numerical Sound Synthesis). The index can vary
at run time.</p>
<h4 id="usage_4">Usage</h4>
<pre><code>si.bus(points) : linInterp1D(points,point) : si.bus(points)
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>point</code>: floating point index</li>
</ul>
<hr />
<h3 id="fdlininterp2d"><code>(fd.)linInterp2D</code></h3>
<p>Linear interpolator in 2 dimensions. Similar to the 1 D version.</p>
<h4 id="usage_5">Usage</h4>
<pre><code>si.bus(pointsX*pointsY) : linInterp2D(pointsX,pointsY,pointX,pointY) :
si.bus(pointsX*pointsY)
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>pointX</code>: horizontal float index</li>
<li><code>pointY</code>: vertical float index</li>
</ul>
<hr />
<h3 id="fdstairsinterp1dout"><code>(fd.)stairsInterp1DOut</code></h3>
<p>Stairs interpolator in 1 dimension. Similar to <code>stairsInterp1D</code>, except it
outputs only the desired signal.</p>
<h4 id="usage_6">Usage</h4>
<pre><code>si.bus(points) : stairsInterp1DOut(points,point) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>point</code>: number of the desired nonzero signal</li>
</ul>
<hr />
<h3 id="fdstairsinterp2dout"><code>(fd.)stairsInterp2DOut</code></h3>
<p>Stairs interpolator in 2 dimensions which outputs only one signal.</p>
<h4 id="usage_7">Usage</h4>
<pre><code>si.bus(pointsX*pointsY) : stairsInterp2DOut(pointsX,pointsY,pointX,pointY) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>pointX</code>: horizontal index of the desired nonzero signal</li>
<li><code>pointY</code>: vertical index of the desired nonzero signal</li>
</ul>
<hr />
<h3 id="fdlininterp1dout"><code>(fd.)linInterp1DOut</code></h3>
<p>Linear interpolator in 1 dimension. Similar to <code>stairsInterp1D</code>, except it
sums each output signal and provides only one output value.</p>
<h4 id="usage_8">Usage</h4>
<pre><code>si.bus(points) : linInterp1DOut(points,point) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>point</code>: floating point index</li>
</ul>
<hr />
<h3 id="fdstairsinterp2dout_1"><code>(fd.)stairsInterp2DOut</code></h3>
<p>Linear interpolator in 2 dimensions which outputs only one signal.</p>
<h4 id="usage_9">Usage</h4>
<pre><code>si.bus(pointsX*pointsY) : linInterp2DOut(pointsX,pointsY,pointX,pointY) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>pointX</code>: horizontal float index</li>
<li><code>pointY</code>: vertical float index</li>
</ul>
<h2 id="routing">Routing</h2>
<p>The routing functions are used internally by the model building functions,
but can also be taken separately. These functions route the forces, the
coefficients scheme and the neighbours’ signals into the correct scheme
points and take as input, in this order: the coefficients block, the
feedback signals and the forces. In output they provide, in order, for each
scheme point: the force signal, the coefficient matrices and the neighbours’
signals. These functions are based on the Faust route primitive.</p>
<hr />
<h3 id="fdroute1d"><code>(fd.)route1D</code></h3>
<p>Routing function for 1 dimensional schemes.</p>
<h4 id="usage_10">Usage</h4>
<pre><code>si.bus((2*R+1)*(T+1)*points),si.bus(points*2) : route1D(points, R, T) :
si.bus((1 + ((2*R+1)*(T+1)) + (2*R+1))*points)
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>R</code>: neighbourhood radius</li>
<li><code>T</code>: time coefficient</li>
</ul>
<hr />
<h3 id="fdroute2d"><code>(fd.)route2D</code></h3>
<p>Routing function for 2 dimensional schemes.</p>
<h4 id="usage_11">Usage</h4>
<pre><code>si.bus((2*R+1)^2*(T+1)*pointsX*pointsY),si.bus(pointsX*pointsY*2) :
route2D(pointsX, pointsY, R, T) :
si.bus((1 + ((2*R+1)^2*(T+1)) + (2*R+1)^2)*pointsX*pointsY)
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>R</code>: neighbourhood radius</li>
<li><code>T</code>: time coefficient</li>
</ul>
<h2 id="scheme-operations">Scheme Operations</h2>
<p>The scheme operation functions are used internally by the model building
functions but can also be taken separately. The schemePoint function is
where the update equation is actually calculated. The <code>buildScheme</code> functions
are used to stack in parallel several schemePoint blocks, according to the
choosed mesh size.</p>
<hr />
<h3 id="fdschemepoint"><code>(fd.)schemePoint</code></h3>
<p>This function calculates the next state for each mesh point, in order to
form a scheme, several of these blocks need to be stacked in parallel.
This function takes in input, in order, the force, the coefficient matrices
and the neighbours’ signals and outputs the next point state.</p>
<h4 id="usage_12">Usage</h4>
<pre><code>_,si.bus((2*R+1)^D*(T+1)),si.bus((2*R+1)^D) : schemePoint(R,T,D) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>R</code>: neighbourhood radius</li>
<li><code>T</code>: time coefficient</li>
<li><code>D</code>: scheme spatial dimensions (i.e. 1 if 1-D, 2 if 2-D)</li>
</ul>
<hr />
<h3 id="fdbuildscheme1d"><code>(fd.)buildScheme1D</code></h3>
<p>This function is used to stack in parallel several schemePoint functions in
1 dimension, according to the number of points.</p>
<h4 id="usage_13">Usage</h4>
<pre><code>si.bus((1 + ((2*R+1)*(T+1)) + (2*R+1))*points) : buildScheme1D(points,R,T) :
si.bus(points)
</code></pre>
<p>Where:</p>
<ul>
<li><code>points</code>: total number of points in the mesh</li>
<li><code>R</code>: neighbourhood radius</li>
<li><code>T</code>: time coefficient</li>
</ul>
<hr />
<h3 id="fdbuildscheme2d"><code>(fd.)buildScheme2D</code></h3>
<p>This function is used to stack in parallel several schemePoint functions in
2 dimensions, according to the number of points in the X and Y directions.</p>
<h4 id="usage_14">Usage</h4>
<pre><code>si.bus((1 + ((2*R+1)^2*(T+1)) + (2*R+1)^2)*pointsX*pointsY) :
buildScheme2D(pointsX,pointsY,R,T) : si.bus(pointsX*pointsY)
</code></pre>
<p>Where:</p>
<ul>
<li><code>pointsX</code>: total number of points in the X direction</li>
<li><code>pointsY</code>: total number of points in the Y direction</li>
<li><code>R</code>: neighbourhood radius</li>
<li><code>T</code>: time coefficient</li>
</ul>
<h2 id="interaction-models">Interaction Models</h2>
<p>Here are defined two physically based interaction algorithms: a hammer and
a bow. These functions need to be coupled to the mesh pde, in the point
where the interaction happens: to do so, the mesh output signals can be fed
back and driven into the force block using the interpolation operators.
The latters can be also used to drive the single force output signal to the
correct scheme points.</p>
<hr />
<h3 id="fdhammer"><code>(fd.)hammer</code></h3>
<p>Implementation of a nonlinear collision model. The hammer is essentially a
finite difference scheme of a linear damped oscillator, which is coupled
with the mesh through the collision model (see Stefan Bilbao's book,
Numerical Sound Synthesis).</p>
<h4 id="usage_15">Usage</h4>
<pre><code>_ :hammer(coeff,omega0Sqr,sigma0,kH,alpha,k,offset,fIn) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>coeff</code>: output force scaling coefficient</li>
<li><code>omega0Sqr</code>: squared angular frequency of the hammer oscillator</li>
<li><code>sigma0</code>: damping coefficient of the hammer oscillator</li>
<li><code>kH</code>: hammer stiffness coefficient</li>
<li><code>alpha</code>: nonlinearity parameter</li>
<li><code>k</code>: time sampling step (the same as for the mesh)</li>
<li><code>offset</code>: distance between the string and the hammer at rest in meters</li>
<li><code>fIn</code>: hammer excitation signal (i.e. a button)</li>
</ul>
<hr />
<h3 id="fdbow"><code>(fd.)bow</code></h3>
<p>Implementation of a nonlinear friction based interaction model that induces
Helmholtz motion. (see Stefan Bilbao's book, Numerical Sound Synthesis).</p>
<h4 id="usage_16">Usage</h4>
<pre><code>_ :bow(coeff,alpha,k,vb) : _
</code></pre>
<p>Where:</p>
<ul>
<li><code>coeff</code>: output force scaling coefficient</li>
<li><code>alpha</code>: nonlinearity parameter</li>
<li><code>k</code>: time sampling step (the same as for the mesh)</li>
<li><code>vb</code>: bow velocity [m/s]</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>
|