Subsections

## Algorithmic sound

Algorithmic composition often refers to a process that evolves according to a simple set of easy to understand rules. An algorithm is defined as a set of rules for solving a problem in a finite number of steps. One class of generative sounds are known as the mathematical methods which concern finding sequences with useful musical properties by iterative methods. This is actually a serious subversion of the common understanding of the word algorithm. With this kind of algorithmic music the "answer" to the "problem" is the steps through which the algorithm goes. We are interested in the partial solutions that happen along the way, not the final result. A better way of describing this pursuit is to consider it as musical applications of sequence. See the online encyclopedia of integer sequences maintained by AT&T to get an insight into the extent of this well documented branch of mathematics [32]. In normal computing we want an algorithm to terminate as quickly as possible, to go through the least number of steps and return a value. In iterative algorithmic sound we usually want the opposite effect, to keep the algorithm running through its steps for as long as possible.

Depending on the language used and the program interpreter a few lines of code or even just a few characters can define many hours of evolving sound. Sequences that can be defined by induction and computed with recursive algorithms may only need a pair of numbers to specify their entire range. Like synthesis an algorithmic sequencer uses equations that produce functions of time, but unlike waveforms they are seldom periodic. Instead they are designed to follow patterns that are musically pleasing melodies or harmonies. Algorithms with musical uses leverage complexity (chaos), self similarity and quasi-periodicity to produce patterns that have a degree of order. Fractal equations such as those generating the Mandelbrot or Julia sets, or recursive procedures which generate number sequences like the Fibonacci sequence are common devices.

An important thing distinguishing synthesis from algorithmic sound is that synthesis is usually about sounds produced at the sample and waveform level under careful control, while algorithmic sound tends to refer to the data, like that from a sequencer, which is used to actually control these waveforms. It refers to music composition where we are interested in the abstract model, the emotional forms given by the rules of harmony, melody and rhythm, rather than in the final nuance of how the sound is rendered to the listener. The same algorithmic source might be hooked up to a string section or brass band with similar effects. See Jacob96[14] for an overview. For extensive resources see AlgoNet[31].

### An example of algorithmic sequence

As an example of how a very simple production rule can lead to a complex sequence with a particular behaviour let's consider Collatz hailstone numbers", also known as the 3n+1 trajectory. Take any number, preferably a quite large one, and if it is even divide by two, if it is odd multiply by three and add one. Now repeat with the new number. Formally:

 (1)

If coerced to a range and scale this sequence produces a pair of interesting melodies that converge. Shown in 1 is an implementation in Puredata to generate the next Collatz number in a sequence, the sequence stops at a lower bound of 1 1.

### Markov chains

A Markov chain (Andrey Markov 1856 - 1922) is the name given to a discrete statistical state machine in which the next state is determined by a probability matrix of weights or likelihoods of moving between states in a sequence. The order of a state machine is how many previous state transitions are taken into account when deciding the next transition, in a Markov machine the next state is often independent of previous states. In 2 there are 3 states and a transition may be to either of the other 2 states, or to itself (the state stays the same). If the states represent notes and durations then a probability matrix can create melodies and rhythms. Statistical data can be extracted from existing music in order to easily compose music in a given style.

For example, a Markov machine can quickly be trained to understand 12 bar blues and notice that more often than not a F7 follows a C and that a where a chord has a major 3rd the melody will use a flattened one. This is interesting when data from more than one composer is interpolated to see what Handel, Jean Michel Jarre and Jimi Hendrix might have written together. When encoding more complex musical data such as phrasing, swing, harmony, accidentals and so on, a high dimensional probability matrix grows very quickly and contains a lot of redundancy. They are best deployed in a specific role as just one possible tool in conjunction with other methods. The Puredata implementation shown as 3 is the three state example given above.

Andy Farnell
http://obiwannabe.co.uk/