Sunday, 23 May 2010

Algorithmic Composition with timbres: Klangfarbenmelodie

Algorithmic composition often tends to focus on pitch and rhythm. Today's algorithmic composition tutorial concentrates on timbre, creating algorithmic music by outputting MIDI from MaxMSP [Max] and PureData [PD].

Klangfarbenmelodie (German for tone color melody) and the synonymous French term mélodie de timbres distributes a melody over several instruments rather than assigning it to just one, the listener's focus becomes timbre rather than pitch.

In a similar way, the algorithmic composition patch we'll build today outputs series of overlapping randomly chosen timbres to create an interesting musical texture.

Jump to the end of the post to hear some sample algorithmic music output from this patch.

Algorithmic Composition with MIDI Timbres
Firstly we'll get a simple MIDI note to play in Max and PureData: add a toggle, a metronome object, a message and makenote and noteout objects. If you're not sure how to do this, work through some of the earlier algorithmic composition tutorials here:
Your Max or PureData patch should now look like this, you should also hear a MIDI note when you turn the toggle on. If not, check you have a MIDI output device selected.
algorithmic composition with timbre Max 1algorithmic composition with timbre PureData 1

Add random and pgmout objects, this will output a random MIDI program change - each note should now play with a different timbre:
algorithmic composition with timbre Max 2algorithmic composition with timbre PureData 2

We'll now output a MIDI controller message. MIDI controller #7 controls the volume for that MIDI channel. We'll add a number box in PureData and an integer in Max, this will be connected to our metronome, the makenote duration and a float object. We then use line (to create ramp between tow points) and pipe (to delay a message) - this results in the note fading up in volume for half of its duration and fading out for the other half. Your Max patch should now look like this:
algorithmic composition with timbre Max 3
And if you're creating your algorithmic composition patch in PureData, something like this:
algorithmic composition with timbre PureData 3

When you turn the toggle on you should now hear random timbres fading in and out. So far we've been triggering only a single note, we'll make the pitches more varied by storing some scales in a coll object:
algorithmic composition with timbre Max 4

Coll is used in the same way in PureData to store these four scales:
algorithmic composition with timbre PureData 4
We'll add some controls and send for our patch to enable us to modify the parameters of our algorithmic composition:
algorithmic composition with timbre Max 5
The objects to add for PureData are very similar to Max:
algorithmic composition with timbre PureData 5
Create a new subpatch called kfb [in Max type N for a new object then type p as the first letter, in PureData CMD1 for a new object type pd to create the subpatch]. Paste in the main part of your patch and add the following:
  • Three receive objects: r on, r speed and r scale.
  • A loadbang and a '1' message this is used to set MIDI output of pgmout, makenote and ctlout. We could type the channel output directly into these boxes, but this means we only have to set the MIDI channel once and we can change the channel for all 3 objects.
  • Add trigger and random objects, these will choose a random length for our note up to the maximum set by the speed send and receive.
Your kfb subpatch in Max/PureData should look now look something like this:

algorithmic composition with timbre Max 6 algorithmic composition with timbre PureData 6

Duplicate this subpatch 15 times (select the subpatch and press CMD D on a Mac and CTRL D in windows). Next we'll change the message that currently says '1' (the message connect to the loadbang at the bottom of these subpatches). Change this message so each subpatch is sending out to a different MIDI channel, set the first subpatch to 1, the second subpatch to 2 and so on. Each of the 16 separate subpatches should send out on an individual MIDI channel from 1 to 16. Your main patch window should now look something like this:
algorithmic composition with timbre Max 7

algorithmic composition with timbre PureData 7

Set the speed (try around 10000 to start) and choose one of the four scales. Turning the toggle on should start this algorithmic composition patch running, with 16 MIDI channels fading in and out with different durations and randomly selected MIDI timbres.

Although it's a simple algorithmic composition idea: random timbres, durations and scale notes it can results in some quite pleasing evolving ambient textures.

It's worth trying to build this patch from scratch, but you can also download the complete patches here:
There are lots of possible ways this patch could be extended for example:
  • Create a master timer and have different sections that vary over time:
    • the first minute max duration = 25,000 scale: Harmonic minor
    • the next 30 seconds max duration = 5000 scale: Augmented
    • the final 30 second max duration = 15000 scale: Major
You could also ramp between these settings over time using the line object.

You can hear some sample output for this patch here

We'll look at other techniques for composing with timbre in future algorithmic composition tutorials using Max, PureData, OpenMusic and more. Subscribe to the RSS feed and check back for more algorithmic composition tutorials soon.


Gramsham said...

This is wonderful stuff! Thanks a lot....more please!

Anonymous said...

what program are you using to organise all the midi instruments in the background?

Anonymous said...

How can I get the chords to only be triggered once instead of them constantly playing?

Post a Comment