This is a port of a Pd patch by Martin Brinkmann that in turn is a port of a Reaktor ensemble by lazyfish. I wrote this SuperCollider patch in 2006 and recently revisited the code, added a preset system and made it run under the current SuperCollider version 3.4.
Though there are a lot of things that could be improved. The graphical interface is particularly rough and ugly.
Attached is the code and a short MP3 with example sounds.
Today I cleaned up and finished a class belonging to my redSys quark. The class can read and write bitmap images (.bmp files). To get it run the following command in SuperCollider...
It's a fairly slow and useless class but well, it can generate images relatively fast. And saving to disk is also quite quick. But avoid drawing the images to screen. The built-in makeWindow method is very slow as it goes through width*height number of pixels and draws a rectangle for each using Pen.
There are two ways to run AppleScripts from within SuperCollider. One is to construct a string with osascript -e and a unixCmd, the other is creating a cocoa NSAppleScript object with the SCNSObject cocoa binding class. The later method is slightly more involved but runs way faster.
"osascript -e 'tell application \"Finder\" to activate'".unixCmd;
"osascript -e 'tell application \"TextEdit\" to activate'".unixCmd;
//--NSObject version - this only work on old OSX SuperCollider versions
a= SCNSObject("NSAppleScript", "initWithSource:", ["tell application \"Finder\" to activate"]);
a.invoke("executeAndReturnError:", [nil], true);
SCNSObject.dumpPool; //should be 0
SCNSObject.freePool; //free stray objects if any left
Also, I've attached a simple class that wraps the functionality. It's called RedEarth.
If e has three or more neighbours that are plants, then e will become a plant at the next time step (assuming it isn't trampled by a herbivore or carnivore).
For every herbivore, h (in random order):
Decrease energy reserves of h by a fixed amount.
If h has no more energy, then h dies and becomes an empty space.
Else, if there is a plant next to h, then h moves on top of the plant, eats it, and gains the plant's energy.
If h has sufficient energy reserves, then it will spawn a baby herbivore on the space that it just exited.
Else, h will move into a randomly selected empty space, if one exists, that is next to h's current location.
For every carnivore, c (in random order):
Decrease energy reserves of c by a fixed amount.
If c has no more energy, then c dies and becomes an empty space.
Else, if there is a herbivore next to c, then c moves on top of the herbivore, eats it, and gains the herbivore's energy.
If c has sufficient energy reserves, then it will spawn a baby carnivore on the space that it just exited.
Else, c will move into a randomly selected empty space that is next to c's current location. If there are no empty spaces, then c will move through plants.
The rules are fairly simple but the result is complex. Carnivores feed on herbivores that in turn feed on plants. Populations grow, get overpopulated and die out just like in nature. The SuperCollider code is a bit cryptic using a lot of nested arrays for efficiency reasons but near the top, there are user settings to play with.
This is something I originally wrote for the article Audiovisuals with SC and now rewrote as separate classes. There are four classes all implementing the same system slightly differently. Two for graphics (Whitney, Whitney2) and the other two for patterns (Pwhitney, Pwhitney2).
The principle for this system is described by John Whitney in his book Digital Harmony (1980) and reimplemented musically by Jim Bumgardner in his Whitney Music Box (2006). The idea is simple but complex patterns arise - both in graphics and in harmony/rhythm. The innermost ball moves at a certain speed, the ball next to it doubles that speed and the ball next to that triples the speed etc. There's a sound played for each ball as it passes through 0. Each ball's sound plays at a different frequency mapped to some scale, overtone series or something else.
Another very old SuperCollider class I never got around to publish. It's called Pfork and makes it possible to blend or fade out patterns in other ways than plain [volume] crossfading. It was originally written for the installation Intelligent Street (in SC2) where it was used as a way of creating new music styles from a mix of multiple other styles.
Here's one example of slowly zeroing out amplitudes in a 16 step pattern. frac is a value slowly changing from 1.0 to 0.0 and indicates how many values to zero out. The fork pattern is [3, 1, 2, 0]. This pattern decides which indices to zero out and in which order. So here index 3 is first in the fork pattern and will thereby be seen as the least important in the original pattern. All indices 3 will be zeroed out first. After that all indices 1 and so on. The last indices zeroed out (i.e. kept until frac is almost 0.0) are the indices 0 - ie the first beat out of 4 in the original amplitude step pattern.
This ASCII printout should help visualise what is happening...