[ann] miSCellaneous v0.22 - general ODE integrator: Hopf, van der Pol, Duffing etc

Hello,

I’d like to announce miSCellaneous_lib quark v0.22 with a new framework for nonlinear experiments in SC.

Fb1_ODE is a pseudo ugen for integrating / audifying ordinary (systems of) differential equations (ODEs) with initial values in realtime, which is based on the Fb1 single sample feedback class. It comes along with containers for ODEs and numerical solution methods (Fb1_ODEdef, Fb1_ODEintdef). Both are basically Dictionaries of Functions and provide an interface for adding new ODE systems or integration methods interactively. An Fb1_ODE (or one of its wrappers Fb1_X) then merges the functional composition of numeric procedure and ODE into the SynthDef graph.
This opens the possibility for immediate audio experiments with the sheer infinite variety of models from physics, electrical engeneering, population dynamics etc., preferably those with oscillatory or quasi-oscillatory solutions and/or chaotic features - or you might want to experiment with designing your own ODEs. The framework could also be used to test ODEs before considering to write integrators as UGens in C++.

Examples with driven pendulum, two body problem, Lotka-Volterra, Hastings-Powell and extensions of exponential decay and harmonic oscillator equations are included in the Fb1_ODE and Fb1_ODEdef help files.

Fb1_X wrapper classes are included for:

Van der Pol
Duffing
Hopf
Hopf adaptive
Hopf adaptive with forced dynamical coupling (AFDC)
Mass-Spring-Damper
Lorenz

The Fb1 interface is now also usable at control rate and as a consequence the ODE solvers can also be run at control rate, which saves resources in the case of LFOs.

Further Options:

  1. ODE parameters can be modulated with kr / ar signals
  2. Time (numeric step delta) can also be modulated with kr / ar signal
  3. Passing of composition Functions with optional ar sources to be applied per sample (e.g. for containing unstable systems)
  4. 6 families with some dozen variants of solution methods implemented (Symmetric Symplectic, Runge-Kutta, PEC, Adams-Bashforth, Adams-Moulton, improved/modified Euler)
  5. Options of Fb1 included (so arbitrary blockSize)
  6. Output of differential and time in additional channels

(1)-(3) offer a wide field for experimentation. The blurring of systems can be fun: e.g. you can experiment with modulating time or define new ODEs from known ones by adding perturbative terms. The systems might become unstable, but with passing a limiting composition Function you can make them stable again. But the aspect of processing might be equally, or even more interesting than that of pure sound generation. Some ODEs, like the adaptive oscillator variants, are designed from that point of view. Here also the blurring can be musically interesting, e.g. when the adaption process contains phases of instability.

Possible drawbacks: As the numerical procedure + the ODE system are merged into the UGen graph, a high number of UGens is needed and the strategy is not super-efficient, however with lower blockSize (I’d recommend 16 or 8 for a nice workflow) at least the compile time can be reduced considerably. Also in certain cases the server’s 32-bit floating point quantization might be of disadvantage for the integration numerics. With unknown ODEs it might also often take some time to find useful initial values / parameter spaces. Related: systems can react extremely sensitive to changes which can cause sudden blowups - so, as always when working with feedback, be careful with amplitudes and consider the ‘compose’ option and/or limiting !

I’m deeply grateful to my colleague David Pirrò here at IEM Graz, who is working a lot in the field of dynamic systems and gave me a number of extremely helpful hints, e.g. regarding oscillators like Hopf and the AFDC frequency adaption variants. Especially important: due to the nature of ODE audification the use of symplectic procedures (instead of the popular standards) is strongly recommended if you want to preserve periodicities - it’s likely to encounter drifts in the longer run with commonly used procedures, already in the case of a simple harmonic oscillator (see examples)! In short, symplectic procedures preserve volume (in a geometric sense) and, physically spoken, energy, so they provide exactly the features mainly needed for ODE audification. See the chapter on integration in David Pirròs dissertation [1, pp 135-146], also Christopher Rackauckas’ comment with further links [4].

But of course you might check other integration methods too. There are cases with remarkable audible differences between the schemes, the numerical procedure then itself becomes the a central part of the synthesis process, an interesting topic between aesthetics and exact math.

David Pirrò has also developed a dedicated compiler for the optimized audification of ODEs, named Henri, which you might be interested in [2, 3].

Big credit also to Nathaniel Virgo, who brought up the buffering strategy used in Fb1 – without that initial trigger also Fb1_ODE wouldn’t have come into being.

ODEs are a huge field and currently only the above mentioned wrapper classes are shipped with miSCellaneous. To define your own Fb1_ODEdefs check the SIAM publication Exploring ODEs [5] with an experimental approach and a lot of links and examples. Also note that ODEs of one type can be defined in different forms and the decision for a certain parameter set can have a huge impact on the musical usability - in fact parameter spaces have to be explored practically.

So far my primary concern was to get things working, at a later point I might come up with more examples, wrappers and usage strategies from an aesthetical point of view.

Have fun, regards

Daniel

https://www.daniel-mayer.at/software_dt.htm

Links:

[1] Pirrò, David (2017). Composing Interactions. Dissertation. Institute of Electronic Music and Acoustics, University of Music and Performing Arts Graz. Free download from: https://pirro.mur.at/media/pirro_david_composing_interactions_print.pdf
[2] https://pirro.mur.at
[3] https://git.iem.at/davidpirro/henri
[4] https://scicomp.stackexchange.com/questions/29149/what-does-symplectic-mean-in-reference-to-numerical-integrators-and-does-scip
[5] Trefethen, Lloyd N.; Birkisson Ásgeir; Driscoll, Tobin A. (2017): Exploring ODEs. SIAM - Society for Industrial and Applied Mathematics. Free download from: http://people.maths.ox.ac.uk/trefethen/Exploring.pdf

5 Likes

Excellent work and great resources Daniel. Thank you for sharing.