Richard's Chaos (Remixed mov-Version)

Instead of blog-blabbering some bullshit about the great new iTunes feature — Oh yes, I do love podcasting! — I uploaded a remix of Richard's Experiement of Programming by Accident aka Richard's Chaos. I added some color to it, captured ever frame on my harddrive (using saveFrame()) and save it as a video.

A couple of days ago I got a hold of sas21's DV-Cam and used it with my little capture program

The upper half of the images shows a shapshot of the scene which is the source for the image in the lower part.
At the moment I am working on transforming the images it creates into sound.Here's the modified version of Richard's Processing code (I extracted the class since I am planning on using the pattern it creates with my capture program):

Chaos c;
	
void setup() {
  size(200, 200);
  c = new Chaos(width, height);
  framerate(15);
}
	
void draw() {
  c.update();
}
	
public class Chaos {
  int num = 2000;
  int range = 4;
  float rangetick = 4;
  int w; // stores the width of the app
  int h; // sortes the height of the app
	
  float[] ax = new float[num]; 
  float[] ay = new float[num]; 
	
  Chaos(int w, int h) {
    for(int i=0; i < ax.length; i++) {
      ax[i] = 0;
      ay[i] = 0;
      this.w = w;
      this.h = h;
    }
    println(”Chaos object initialized (” + this.w + “, ” + this.h + “).”);
  }
	
  void update() {
    rangetick = rangetick + 0.05;
    range = int(rangetick);
    // Shift all elements 1 place to the left
    for(int i=1; i < ax.length; i++) {
      ax[i-1] = ax[i];
      ay[i-1] = ay[i];
    }
    // Put a new value at the end of the array
    ax[num-1] += random(-range, range);
    ay[num-1] += random(-range, range);
    // Constrain all points to the screen
    ax[num-1] = constrain(ax[num-1], 0, width);
    ay[num-1] = constrain(ay[num-1], 0, height);
    // Draw
    for(int i=2; i < this.ax.length; i++) {
      float val = float(i)/num * 204.0 + 51;
       // this is where I added some color
      stroke(val, int(random(255)), int(random(255)));
      curve(
       int(random(this.w)), int(random(this.h)), 
        ax[i-1], ay[i-1], ax[i],ay[i], 
       int(random(this.w)), int(random(this.h)));
    }
  } // end of update()
} // end of Chaos

Leave a Comment

You must be logged in to post a comment.