Algorithmic Composition

Most of the readers of this document will no doubt be familiar with creating music using sequencing software or hardware. In this compositional process the composer determines the melody and the rhythm and transfers them to the sequencer by hand. But wouldn't it be nice if the computer could do some of the composing work? Is it even possible for a computer to do so? The computer generation of music is often referred to as algorithmic composition where the word algorithmic refers to the use of a computer program, or algorithm, to specify the music structures.

The Nord Modular contains some modules that are useful for composition. Some of these, such as the Sequencer modules, require human interaction to define the notes and rhythms. Others, such as the pattern generators, can run on their own. There are many Nord Modular patches in the archives, often referred to as "noodles", which need no human interaction to produce interesting music. Most of these noodles are carefully hand-crafted, however, and the music is clearly man-made. The noodles are usually of a fixed nature, and cannot generate radically different musical creations. But, in spite of this, the Nord Modular IS capable of pure algorithmic composition, which can generate radically different music with little human intervention beyond setting a few parameters. In this chapter we will look at a few different types of algorithmic composition that can be implemented on the Nord Modular.

Chaos and Fractal Music

Mathematic chaos is a study of rather simple systems that produce rather complicated behaviour. This is perfect for making music on modular synthesizers, since we all know interesting music is complicated, but we can't implement very complicated equations with the limited resources of modular synths. The patterns produced by chaotic systems bear some similarities to random noise, such as we use to make snare drums and so forth, but tend to have much more structure. The chaotic patterns tend to be "quasi-periodic", that is, the output of the system follows a regular pattern, but not exaclty. From cycle to cycle, the patterns are slightly different. Obviously, totally random noise is not too useful for specifying melodies and rhythms (although some may argue to the contrary). But chaotic patterns seem to have just the right mix of randomness and repeatability to produce interesting music. In the following section we present two Nord Modular patches which use different chaotic systems to produce self-generated music.

The first patch we will look at was designed by Rob Hordijk. It implements four simple non-linear ecosystems, defined by the formula that Mitchell Feigenbaum used to come to his 'Chaos'-theory. The equation that governs this chaotic system is

X(t+1) = G * X(t) * (1 - X(t))

This equation is known as the Logistic Equation. It was first used to model the population of animal species from year to year. In the equation above X(t) is the ratio of the actual population to the maximum population. Each iteration (e.g. from one year to the next) gives the new relative population in terms of the old one. The parameter G is the effective growth rate. The two terms in the equations model the fact that more animals will have more offspring (so growth is proportional to X), but will compete for resources. As the population increases the load on the environment increases reducing the availability of resources and limiting the growth rate. This is modeled by the (1-X(t)) term. For growth rates G less than 1, X(t) tends to 0. For growth rates between 1 and 3, X(t) tends to 1 - 1/G. Beyond G=3 a bifurcation occurs causing an oscillation from year to year. (corresponding to high and low populations in alternate years). Further bifurcations occur until at G = 3.53... chaotic dynamics set in.

What does all this animal husbandry have to do with the dog-eat-dog world of musical synthesis? Well, the chaotic behaviour exhibited by the logistic function can be used to produce interesting music. In the patch below the X values are used to play notes, but they could be used to control anything. In the patch there are four separate chaotic systems implemented. The systems can influence each other. They can be helped by their right neighbours to become more alive while their growth can be suppressed by their left neighbours. Sounds like real life, don't it? Well, actually it sounds like NM, so don't worry, no need for peace keeping forces in your machine. ...Sounds like NM... means some external effects like reverb, etc. required. Some settings can make all four systems slowly succumb, others can result in chaotic behaviour, and somewhere in between there should be "easy livin'", a thing that I did knew before (...before the NM, that is...). In the figure below we show 1/4 of the entire patch, corresponding to one of the four chaotic systems (clicking on the figure will give the entire patch, however).

Figure 1. Chaotic system patch using the Feigenbaum attractor (R. Hordijk).

x=gx(1-x)Version02.pch by Jim Clark

For the equation to work it can not start with a zero value for X, as nothing can grow out of nothing unless some "Act of God" is involved. So a provision is made that a small value is automatically added to X only on the first cycle when X is zero due to patch loading conditions.

The following patch implements another type of Chaotic system, this one termed the Henon strange attractor. This system was discovered by the French astronomer Michele Henon while studying the dynamics of stars moving within galaxies. The equations for this system are:

x(n+1) = 1 + y(n) - a*x(n)*x(n)

y(n+1) = b*x(n)

The Henon system is 2-dimensional, unlike the logistic system described earlier, which was 1-dimensional. That means it produces two values which you can use to control various aspects of the music. The following patch generates a quasi-periodic melody (in Eb major, but you can change this by changing the notes selected in the key quantizers).

Figure 2. A chaotic noodle patch using the Henon strange attractor to vary the pitches and rhythms (J. Clark).

Knob 1 controls the dynamics, and determines whether the pattern is repetitive or chaotic.

Knob 2 controls the level of a LFO that adjusts the attractor parameter (Knob 1) to provide a constantly (slowly changing) dynamic. Turn knob 2 to zero to maintain a steady attractor type.

Knob 3 sets the tempo.

Knob 4 sets the delay in the triggering of the second voice.

Knob 5 is used to turn on or off the syncing of the master clock with the second voice trigger. Turning this on causes a change in the beat pattern.

Knob 6 is used to select one of three different modes for generating the second voice trigger.

You can try to play along with the pattern with your piano instead of doing all those tedious Hanon piano exercises!

There is a wealth of information on Chaos on the web and in the libraries. A good starting point would be to read the very accessible book "Chaos: making a new science" from James Gleick. It's a good introduction into chaotic behaviour, really. Very inspiring.

Cellular Automata

by Rob Hordijk 

Cellular automata or 'the game of life' as it is also called, are based on bitpatterns, basically a row or matrix of 'bits' or 'cells'. On every clockpulse the pattern is changed by checking a group of bits and looking up in a table how their specific bitpattern should change. E.g. you could look at the cells immediately around one cell, if there are to many 'alive' (on) it's to crowded and the cell dies (off), if there are to few 'alive' it's to lonely and the cell sadly dies as well. But if there is a comfortable number of cells living around the cell the cell either stays alive or comes alive. This way you get evolving patterns. You need a startpattern that might be random or well choosen, and depending on the startpattern and the 'rules' (the contents of the lookup table) the whole population might live for a long time or die out eventually. A patch that implements a cellular automata is shown below. This patch was constructed by Rob Hordijk.

Figure 3. A Cellular Automata patch for the Nord Modular (R. Hordijk).

Cellular Automata02.pch

About the patch:

To say it in the most precise way, this is what the patches 'emulate': 'Four-bit nibbles' adress sixteen memorylocations, that each hold a nibble, that is looked up on every clockpulse, to be used as the adress in the next iteration. There are three usable nibbles in the patch, each with the same set of 'rules', that is they share the same lookup memorylocations. The contents of the sixteen memorylocations are in practise the sixteen knobvalues.

A nibble is the name for a group of four bits that can represent a hexadecimal number ranging from 0 up to 15. It's half a byte, which is eight bits, so that's why they call it a nibble. (That's all there is to logic, W. As Spock says: logic predicts that one AND one IS one, as TWO is one|zero. Scott me up, beamy...!)

So how it is done:

The patch is not really 'binary' as that would consume still too many modules even in V3. Instead the 'nibbles' are conveniently stored in S&H modules. By decoding a nibble into a one-of-sixteen circuit (the group of compare and XOR modules) sixteen knobs can be adressed. Each knob delivers a new 'nibble' to store in the S&H on the next clockpulse. Also the sixteen outputs of the one-of-sixteen circuit are coded back to the real four bits of a nibble, using so called 'mickey mouse'-logic (the four eight-input mixers). We now have three types of output to work with, {1} the sixteen separate logic outputs of the XOR-modules, only one of these can be on, {2} the three S&H's that can have sixteen values between 0 and 64, values jumping in steps of 4, and {3} the four discrete bits that form the 'nibble' at the outputs of the eight-input mixers, whose values must be interpreted as 0 or anything greater that 0. What to do with the outputvalues is up to you. One patch translates the outputs to harmonic contents of a single pitched sound. Another tries to play melodies and drum the patterns away. As always, the imagination is the limit.

So how to program a pattern:

If knob1 is closed the next selected knob will be knob1 again. If knob1 points to knob2, that one will be the next knob and if that one points to knob5, which on it's turn points to knob1, the pattern will be knob1 - knob2 - knob5 - knob1 - knob2 - knob5 - knob1, etc. So here repetition occurs after three clockpulses, but in general the longest pattern will be sixteen clocks. So to make it more interesting knob16 is replaced by a randomvalue. If in a pattern knob16 is reached it jumps randomly to one of the other knobs. Now it starts to get interesting as in the example the patterns would never use knob3 and knob4 and all knobs after knob5. But if knob3 points to knob4 and knob4 points to knob16, and we will also let knob5 point to knob16 instead of knob1, and all other knbs point to either knob1 or knob 3, the pattern goes random, but not completely random, it starts to randomly play the small fragments all ending with knob16, sometimes preceded by a randomly chosen knob and sometimes jumping into the middle of the first two fragments. There is one 'disallowed' state in the knobsettings, if a knob points to itself the pattern 'hangs' on that knob - the 'population' sadly dies and it's game over.

On loading the patch in a NM slot, the S&H modules will be initialised with values of zero, so the three nibbles all point to knob1. But for every nibble, when knob16 is reached a different random value for each nibble is generated, so the combination of the three nibbles gives a more varied pattern than only one nibble, but still fragments will be more or less recognizable according to the knobsettings.

So knob16 can actually be deassigned in this particular patch, tweaking knob sixteen doesn't do anything as it is replaced by a random value. The 'rule'-values or 'to what value should a knob be set to make it jump to which other one' are:

Jump to Knob 1:

0-7

Jump to Knob 2:

8-15

Jump to Knob 3:

16-23

Jump to Knob 4:

24-31

Jump to Knob 5:

32-39

Jump to Knob 6:

40-47

Jump to Knob 7:

48-55

Jump to Knob 8:

56-63

Jump to Knob 9:

64-71

Jump to Knob10:

72-79

Jump to Knob11:

80-87

Jump to Knob12:

88-95

Jump to Knob13:

96-103

Jump to Knob14:

104-111

Jump to Knob15:

112-119

Jump to Knob16:

120-127

Hope to have been helpful with this explanation. I realize that for a newbie it might not be the most suitable patch to take a look at, but I know lot's of you guys are into patterns and might appreciate this kind of thing, as Clavia haven't published how the 16384 possible patterns in the pattern module evolve. (Ain't you curious? Is it the good old 'rotate-left and XOR with constant' pseudo-random method or is it maybe a Turing-like algoritm? And with that module set to eight steps there could only be 64 patterns, could there? So what settings give the same pattern? Is there a pattern to that? Ain't the whole universe just nothin' but a HUGE barcode pattern of drum'n'bass? Oops..., now I really get off topic)

Cooking Noodles

Jan Punter writes: You'll want to make a sort of a toolbox for yourself, and you'll have to do that by experimenting long enough - random wiring might help you there .... For self playing patches (noodles) the control structure is important, and ideally you'll see a lot of blue cables. In my experience the sound generating modules are not very important for noodling. Of course you'll want an interesting sound, but the movements will be more important. The sequencers are not as useful as they seem, as they tend to give somewhat static results, instead you could try to modulate lfo's with each other and sum some & then run the result through quantizer modules. X-fade modules can be used to dynamically select from a set of of such circuits. The result can be used to control vco frequency for instance. Sample and hold modules are very useful, circuits like flip-flops as well. It would be a good thing to read the tutorials written by Rob and Roland, as well as James Clark's web site. As said by David Peck there are some example noodles made by me in the archive indeed, but they tend to be somewhat hard to understand, as I often resort to random wiring to make things just a bit more livelike. You'll want to use random, but not too random, so use sample and holds to freeze signals, quantizers to constrain the ranges, adders and multipliers to bring them into the most usefulll range. Modulate the modulation signals, don't forget to modulate the modulation modulating signals as well (e.g. use control feedback) Rob Hordijk has made some noodles that are much clearer in their intent. You should also check the patches made by Roland Kuit, mister vjek (alias enon, but see Pattyrson K Lex) made some briljant noodles (in fact he started this whole noodling thing), you might like SDL (but he made a lot of rather plain sequencer stuff as well). Terry Funken has made some nice and simple yet very effective noodles (the kling klang's f.i.) I'm sure I forgot to mention names (David peck did some nice noodles (machines) as well, and there even is a factory preset made by Zon), for which I'm verry sorry, but I'll really have to go fix & eat my dinner now. Maybe Wout knows some more names ? Finally I'll mention my web site, as it will link you to all the resources mentioned above. So see: http://www.iaf.nl/Users/BlueHell/nm/index.htm Some of my noodles are in there as well, but more can be found in the archives.