Monday 22 March 2010

Interpolate Between Two Chords

The last two PureData posts have introduced the idea of simple indeterminacy: including random elements in your compositions.

Today we'll look at a deterministic example, one that given the same input parameters will produce the same output each time.

Imagine we have two notes, we can create an algorithm to 'join the dots', moving from one note to another in a specified number of steps. We need to:
  • Define the start note
  • Define the target note
  • State how many steps we want to take to get from A to B
Now imagine we have two four note chords, we can interpolate between the notes of the two chords in exactly the same way. This leads to some interesting harmonies, but of course is a very different way of thinking about chords, harmony and voice leading than is usual. Not wrong, just different.

This example patch defines two chords using MIDI notes:
  • 36, 43, 49, 79, 100
  • 61, 64, 67, 42, 24
Here we're using 5 note chords but your chords can have as many voices as you like.

This patch uses the 'list-inter' object to interpolate between individual list elements. You need to make sure you have PD extended installed to use this. This object takes 3 inputs
  • A number between 0 and 1 that represents the interpolation between the lists. 0 will output the first list, 1 will output the end list, .5 will be half way between the two.
  • A starting list
  • An ending list
Creating The PureData Algorithmic Composition Patch
This section of the patch divides the number of steps by 1 to give us our interpolation amount between 0 and 1.

This is used together with the counter. We count from 0 to the number of steps, this count is multiplied by our interpolation factor:

This section loads our two chords, the list-inter object is used to interpolate between them, the iter object takes the list of notes and outputs them quickly one after another - so that we hear them at the same time.

The >= 1 object on the left sends a message to the metronome to stop when we reach our target chord.

This final section includes our MIDI output objects. We've also included a random object that is controlling our MIDI velocity to make the dynamics a little more varied and musically interesting.

Here's the entire patch - you can click on the image to see a larger version.

    It's worth trying to build the patch yourself, make your patch look like the screenshot, from the put menu, use objects [PD: CTRL 1, Mac: CMD 1], messages [PD: CTRL 2, Mac: CMD 2], numbers [PD: CTRL 2, Mac: CMD 2], a toggle and bang to create the patch.

    You can also download the completed patch here.

    Once you've created the patch, experiment - this is one of the big advantages of algorithmic composition, you create the process that will write the music and can experiment with the input parameters until you find results that you like. In this patch we can:
    • Change the start and end chords, including the number of voices
    • Change the number of steps that we take to get from A to B
    • Change the metronome speed so we generate our interpolated chords faster or slower
    You can hear some sample output here:

    In future posts we'll introduce more algorithmic composition ideas and start to link these together to form full compositions. We'll also be looking at more examples in other algorithmic composition software including Open Music, Max, Common Music / Grace, Supercollider, Lisp and Java.

    No comments:

    Post a Comment