Sunday 2 May 2010

Algorithmic Composition | OpenMusic Rhythm Trees Tutorial Part 1

In previous algorithmic composition tutorials we've looked at using OpenMusic for algorithmic composition, today's algorithmic composition tutorial introduces Rhythm Trees.

Rhythm trees are a way of representing rhythm with nested lists. The notation can get quite unwieldy and a little complicated, however these disadvantages are outweighed by the advantages. using rhythm trees it's possible to represent very complex rhythms with relatively simple notation, it's also possible to create simple and complex rhythms using algorithmic composition techniques.

The simplest way to work with rhythm trees is to enter a list of rhythms and connect this to the tree input of a voice object.

In the above example we listed two 1/8th notes and two quarter notes. If we work with Rhythm Trees in this manner, OpenMusic assumes a time signature of 4/4. We can also represent rests with rhythm trees, this is done by using a minus value in front of the rhythm value.


Using the same notation it's easy to represent more complex and unusual rhythms:

Rather than typing out these lists, we can of course generate these rhythms algorithmically. Here's a simple example with a repeated note value using the repeat-n function in OpenMusic.

We can also repeat a rhythmic sequence rather than single value. As this will output a nested list (a list of lists, with each list being enclosed by parentheses) we need to use the flat function to flatten the list to a single set of parentheses.

Each of the above examples are deterministic, they will produce the same algorithmic music each time they run. The following examples uses the nth-random function to choose a random rhythm from a supplied list of possible rhythms.


We can combine the two previous ideas by specifying a number of rhythm sequences and using nth-random to choose which rhythm sequences are picked to create the musical rhythm.

All of our examples so far have assumed a time signature of 4/4. The easiest way to change time signatures is to provide a list of time signature to the mktree function.


Of course we could generate our list of time signatures algorithmically:

In a previous OpenMusic tutorial we looked at using OpenMusic to generate CSound scores. If you wanted to use these rhythm trees to generate CSound scores we need to get a list of onsets and a list of durations. The simplest way to do this is to connect a voice object to a chord-seq object. The third outlet of chord-seq is a nested list of onsets, the 4th outlet is a nested list of durations. To output these lists as a CSound score we need to flatten the list as in the following OpenMusic patch:


Any of the algorithmic composition techniques we've used so far can be used to generate rhythms and rhythm trees. We'll be exploring some more of these in future algorithmic composition tutorials and look at some of the other OpenMusic rhythm tree functions.

Subscribe to the RSS atom feed and check back soon for more Algorithmic Composition tutorials.

No comments:

Post a Comment