formating xml in vim

Nikolaus Gradwohl2009-03-28T08:14:00+00:00

i often have to work with xml files that are autogenerated and look very ugly i defined a short keymapping in my .vimrc file that calls xmllint --format - on the current buffer

map xf <ESC>:%!xmllint --format -<CR>

open any xml file and press 'xf' in command mode.

read more ...

blooming tree in processing

Nikolaus Gradwohl2009-03-19T19:18:00+00:00

because spring is getting near, and everyone is googling for flowers and bees (i have about 10 hits a day all coming from google searching "ascii flower bee"),

i made a processing-sketch showing a blooming tree

every time the applet is started it grows it unique tree

bloom

read more ...

Boids Demo

Nikolaus Gradwohl2009-03-15T15:00:00+00:00

I just wrote a boids-demo in processing.

the boids obey the 3 rules defined by Craig Reynolds.

click here to see some boids flying around

boids

read more ...

how to detect presentmode in processing

Nikolaus Gradwohl2009-03-15T10:21:00+00:00

in processing sketches can be run in "present" mode. which means a frame is generated in fullscreen mode and the code of the sketch is centered on the screen.

to change the size of the actual sketch depending on wether presend mode is active or not
the following code can be used

void setup() {
    for ( int i = 0; i < args.length; i ++ ) {
      if ("--present".equals(args[i])) {
        present = true;
        break;
      }
    }
    if (present) {
      size(screen.width,screen.height, OPENGL);
    } else {
      size(600,600, OPENGL);
    }

    // do your normal setup stuff here
}
read more ...

3d Particle effect demo

Nikolaus Gradwohl2009-03-15T10:15:00+00:00

i used the makeTexture method from my firefly sketch to make a 3d particle demo

click here to download the sourcecode.

particles

read more ...

Digital Fireflies

Nikolaus Gradwohl2009-03-14T21:14:00+00:00

I made another processing sketch that showes something glowing

click here to see some fireflies whirrl
arround

fireflies

read more ...

Rotating Stereo Cubes

Nikolaus Gradwohl2009-03-14T09:18:00+00:00

I made my first 3d processing sketch that generates a stereo image for cross eyed viewing

click here to see the cubes rotate

rotating cube

read more ...

window resizing in processing

Nikolaus Gradwohl2009-03-08T19:50:00+00:00

The following processing code shows how to resize a processing window from your code. the resizeApp methdo calculates the difference between the frame size and the size of the actual drawing area and adds it to the new size. then the application-frame is resized.

void setup() {
  size(320,200);
}

int col = 0;

void draw() {
  background(col);
  stroke(255,0,0);
  line(0,0,width, height);
  line(0,height,width,0);
}

void mousePressed() {
  if (col == 0) {
    resizeApp( 640, 400 );
    col = 255;
  } else {
    resizeApp( 320, 200 );
    col = 0;
  }
}

void keyPressed() {
  exit();
}

void resizeApp( int w, int h ) {
  int delta = frame.getHeight()-height;
   resize( w, h );
   frame.setSize( w, h + delta );
}
read more ...

osc linkdump

Nikolaus Gradwohl2009-03-08T17:37:00+00:00

http://opensoundcontrol.org the mother of all osc pages ;-)

http://nodebox.net/code/index.php/OSC osc support in NodeBox a programming environment based on python - with strong processing influences

http://hans.fugal.net/src/rosc/ osc support for ruby

http://www.ixi-audio.net/content/body_backyard_python.html simple osc library for python

http://frey.co.nz/projects/ofxosc/ osc library for openframeworks

http://www.audiomulch.com/~rossb/code/oscpack/ osc library for c++. is used by ofxosc

http://www.sojamo.de/libraries/oscP5/ osc library for processing

http://chuck.cs.princeton.edu/doc/language/event.html chuck osc documentation

https://www.local-guru.net/blog/2009/03/06/osc-events-in-pd osc events in puredata

http://supercollider.svn.sourceforge.net/viewvc/supercollider/trunk/build/Help/ServerArchitecture/Server-Command-Reference.html supercollider osc command reference

http://supercollider.svn.sourceforge.net/viewvc/supercollider/trunk/build/Help/Control/OSCresponderNode.html supercollider OSCresponderNode documentation

http://mtg.upf.edu/reactable/?tuio osc based protocol for tangiable user interface

http://wiki.monome.org/view/40hOscProtocol the monome protocol

http://www.grahamwakefield.net/MAT-F04/233/index.html java based osc sequencer

read more ...

osc events in supercollider

Nikolaus Gradwohl2009-03-08T17:18:00+00:00

supercollider uses osc to controll the synthisizers internally, but i wanted a supercollider synth to react to my osc events instead of having to send supercollider-osc events from my app

after some research in the help files i found out that OSCresponderNode does the trick.

the code example shows how to register for an osc event and trigger a synth. now i can use a supercollidersynt with my ruby osc sequencer

(
    SynthDef( "guru2", { arg mfreq=40;
        var env, amp;

        env = Env.perc( 0, 0.2 );
        amp = EnvGen.kr(env, 1, doneAction:2);

        Out.ar([0,1], SinOsc.ar( mfreq.midicps ) * amp * 0.5);
    }).send(s);
)

n = NetAddr("127.0.0.1", 57120)
o = OSCresponderNode(nil, '/melody', { |t, r, msg| Synth( "guru2", [\mfreq, msg[1]]);  }).add;

o.remove
read more ...