Friday, September 5, 2008

Archaeopteryx: Forked Versions On GitHub

Due partly to my slowness in handling pull requests, partly to general mad travel-related busy-ness, and mostly due to the awesomeness of GitHub, there are several forks of Archaeopteryx on GitHub: refactoring forks, a fork with better tests and specs, a related project enabling MIDI in, and a context-free grammar fork:

It's a rule based generator, not necessarily just for melodies. drum_example.rb uses a probability matrix to fire off rules. Those rules can call other rules and so on. If a rule is defined more than once, the generator picks randomly from each of them.

So a matrix could call a rule named :snare which is defined several times each time doing something different, varying a velocity, note number, or whatever. Say I want a bit more variation in what the snare is doing, I can make a rule that plays a triplet and hear the results realtime. And when it plays a triplet, maybe I want the last note accented, another rule or two and it's done.

The point is, is that it allows me to develop a rhythm or aleatoric melody and evolve it over time. It's pretty easy to get started with it playing quarter notes, or a scale or whatever, and turn that into something insanely complex as more and more rules are added. Each of the transformations become little toys to experiement with. A programmer/musician can develop what-ifs and hear those live. What if I send all the hi-hat hits back in time a beat or two, what if I shift this part up an octave? What if I play a static melody and shift it from dorian to lydian? What if I create a treble glisando triggered off of the tone of the occasional note of the sub-bass?

I don't know what kind of music this will be good for, but I know from the ContextFree Art community that the concept is a ton of fun (their community gallery at contextfreeart.org has lots of examples). It's interesting to see what I get with that applied to music.

Another concept I've built into this is the Canvas class. All the notes are placed on a grid as hashes. So for example, I could have one rule place a E3 notes on every 16th note. Then have matrix fire off rules that tweak the velocity of the note on E3. Then add in another that tweaks the modulator, etc.


I'm having trouble keeping up with all the interesting things people are doing with my code, but that's a great problem to have.