## 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:

### Second Order Markov Chains in PureData

It's been too long since the last algorithmic composition post, but a series of new posts are on the way!

To kick things off we'll revisit one of our previous Markov chain algorithmic compositions. Previously we looked at first order Markov chains in PureData. We also extended this into a second order Markov chain in Max.

Let's have a quick recap first.

First Order Markov Chains
In a previous Algorithmic Composition post we built a first order Markov Chain analysis and generation patch. In 1st order Markov chains the next note is based on the current note and a list of probabilities for following notes. This is stored in a State Transition Matrix (STM), here's an STM that lists the notes of Happy Birthday and the probabilities of each subsequent note.

Second Order Markov Chains
Second order Markov Chains choose the next note based on the two previous notes and the probability of subsequent notes following those two notes: