## Monday, 27 June 2011

### Tom Johnson's Self Similar Melodies

The American Composer Tom Johnson often uses simple mathematical principles in his compositions. Today's algorithmic composition tutorial looks at a few of Johnson's algorithmic concepts and applies them using Max and PureData. As Max and PureData use slightly different objects to read and write data from tables we'll include screenshots of the algorithmic composition patches from both applications.

Self Similar Melodies
This first example taken from Johnson’s now out of print book ‘Self Similar Melodies’ makes use of the following expression:

n             n+1            n-1             n

Inputting a zero into our algorithm gives us the following four numbers:

0            1            -1            0

It’s easy to apply this in PureData:

and in Max:

This expression can be used to produce an infinitely long melody, by applying the formula to each of the numbers in turn, each number in the sequence adding four further numbers to the end of the sequence.

Applying the formula to the first and second numbers give us:

0          1          -1         0          1          2          0         1

Applying the formula four times gives us:

0   1   -1   0   1   2   0   1   -1   0   -2   -1   0   1   -1   0

We then need to store each succession of numbers in a table so that we can recall it later:
And in Max:
The next step is to output the results to a MIDI device. The simplest approach is to map the numbers to chromatic pitches, in this case it creates a 'flight of the bumblebee' like melody:
And in Max:
As an alternative to chromatic pitches we can map the algorithmic output to a scale. First let's define the intervals of a major scale and store them in a table in Max:
And in PureData:
Then we can use the output from our algorithm as an index to our major scale intervals. The only problem is that we also have some negative numbers, so in Max we'll use an expression to send the negative and positive numbers to different outlets:
and to similar effect we've used the moses object in PureData:
You should now be generating some output using one of Tom Johnson's. There are many ways you can extend these ideas including mapping the algorithm to different musical elements (e.g. rhythm, dynamics etc.) or creating polyphonic parts that run at different speeds in different octaves (e.g. running at half speed one octave lower, quarter speed two octaves lower. Estonian composer Arvo Pärt uses similar techniques in his 'Tabula Rasa' compositions).
We'll be looking at a few more of Tom Johnson's algorithmic composition ideas in future posts so do check back soon for another algorithmic composition tutorial.