Friday, October 17, 2008

Archaeopteryx: What Is The Matrix?

Unless you're creating a large number of unique drum patterns based on the same fundamental rhythmic template, you probably don't need to know anything about the probability matrices in Archaeopteryx. If you want to convert an RSS feed into a sequence of notes, for example, you can do that without a probability matrix.

The probability matrices in Archaeopteryx represent an evolution in step sequencers. Here's a demo video explaining how to use a popular prosumer step sequencer:



People have been using step sequencers since at least 1980.



The normal step sequencer allows you to specify a matrix of drum instructions. These instructions are boolean: do play the kick drum on the first beat; don't play the snare drum on the third beat. A 3x3 matrix of boolean values looks like this:



You can use the step sequencer in Archaeopteryx in many different ways. I'm hoping to demonstrate it running hardware at RubyConf, but I have to find the hardware first (I left it in New Mexico). I almost always use Arx with the Redrum drum machine in Propellerhead Reason. This drum machine has 10 drums and its standard step sequence length is 16 steps.



This means the Redrum gives you a 10x16 matrix. The db_drum_definition.rb file in Archaeopteryx also provides a 10x16 matrix. However, where you can only enter boolean values in Redrum's matrix, Archaeopteryx allows you to specify floats. That means in addition to saying do play the drum or don't play the drum - which would be expressed with values of 1.0 or 0.0, respectively - you can also say maybe play the drum, and specify precise values for maybe. So instead of a black and white grid, you have a grid with shades of grey.



It's very easy to create drum rhythms with a typical step sequencer, but your tools for creating variations on those rhythms tend to be somewhat limited. Once you define a fundamental rhythmic template for Archaeopteryx as a probability matrix, it becomes effortless to generate either a finite or an infinite number of variations on that template. This is because you can leverage the matrix two ways.

Archaeopteryx's AI step sequencer filters the output of a number generator through its probability matrix to determine whether or not to play a given drum on a given beat. If you provide the step sequencer with a number generator like this:

L{0.9}

It will generate the same beat every time, since its filtering process will every time evaluate the same number against the same value for maybe.

If you provide the step sequencer with a number generator like this:

L{rand}

It will generate a different beat every time, because its filtering process will every time evaluate a different number against the same value for maybe.

That's what's going on here: