New Quark: NatureToolkit
23 Nov 2009NatureToolkit is a Quark that will include classes and frameworks that will hopefully make life easier for those, whose artistic media work tends to get inspiration from natural processes.
The only included class right now is LSys (but there is more to come! See bottom of this post…) which is a complete Lindenmayer Systems implementation for SuperCollider. There are various other string rewriting systems available for SC right now, but details of real L-Systems are more complicated. The rewriting system needs to be aware of branching points when context sensitivity comes into play for example, and this class supports them. In short, this class does parallel rewriting, supports context free, context sensitive, stochastic and parametric rulesets. When working with context sensitive rules in a bracketed L-system, this class takes axial node points and segment neighborhood into account (which is not represented in the sequential string representation naturally). Full documentation is included and there is an accompanying LSPlant class that interprets the produced strings using the standard Turtle Graphics method so it helps you visualize the produced data.
I’m more interested in the musical applications of L-Systems. The self similarity on various domains of artistic works is often overlooked, but it can be observed in many time scales with detailed inspection (or sometimes it is very obvious and taken for granted; the fugue form / technique is a good starting point).
For an intro on L-Systems, consult here first, then I suggest you grab a copy of Algorithmic Beauty of Plants (Przemyslaw Prusinkiewicz – Aristid Lindenmayer) from here.
For musical applications of L-systems, I suggest you go read the master’s thesis of Stelios Manousakis: Musical L-Systems that discusses applications of L-Systems down from sample scale to macro scales. There also is a body of past research on this area, you may want to search some databases.
Here is some not-so-interesting visualizations (the code for these is also included in the documentation) that I’ve created while I was developing the class to see if things were really working as they should.
Context free examples:
Islands and Lakes from Algorithmic Beauty of Plants Fig 1.8:
Quadratic Snowflake from A.B.O.P. Fig 1.7b:
Branching Examples:
Tree from A.B.O.P. Fig 1.24c:
Tree from A.B.O.P. Fig 1.24f:
Stochastic Branches:
Stochastic rules lets you define a single string and stochastic rules which create different yet coherent products each time. The following 3 trees were all generated from the same axiom and rules (A.B.O.P. Fig. 1.27):
Parametric Systems:
Parametric L-Systems allows you to define axioms with parametric arguments and the parallel rewriting system makes them interact. Really complex yet self-similar forms can be crafted with them! The following 5 images are taken from 1 to 5 iterations of the classic “Row of Trees” example. A simple axiom can yield to complex self similar structs:
Context Sensitive L-Systems with Brackets (Branches):
This is where the string rewriting mechanism should take axial nodes and branch neighborhood into account to work properly. Really sophisticated structures are possible by using signal propagation mechanisms of L-Systems.
Examples are Fig 1.31 (a, b, c, d) from A.B.O.P:
Other notes:
As mentioned earlier, the examples here are Turtle Graphics interpretations of generated strings, as L-Systems were first developed for algorithmically generating (and observing growth of) plant structures. Actually this is the direct visual representation of generated strings, but one can use it in many different contexts or visualizations. I’m especially interested on their applications for musical form and structure, the generated strings are really easy to interpret and use on different contexts. I hope others will also find them of use, you can get NatureToolkit from the SC Quarks repository, as usual.
More to Come:
NatureToolkit is far from complete with an L-System implementation of course. I’ve also developed a general purpose fully modular Genetic Algorithm framework for SC as well as an automatic parameter matching system (finding suitable parameters (inferred from an input sound) for a given synthesizer topology) utilizing the framework (the parameter matching system can use multiple processing cores of a computer and can also parallelize the tasks across multiple computers for analysis so it is also suitable for real-time use yay!), but the documentation isn’t complete yet and it is accompanied by a paper I’ve submitted to EvoMUSART 2010 conference (European Event on Evolutionary and Biologically Inspired Music, Sound, Art and Design) and I’m not allowed to publish it publicly yet. You can still have a test drive if you are interested, just get the sources from my github. I’ll be happy to give support for the adventurous spirits out there.