[PD] brainstorming on algorithmic melody generation

Chris McCormick chris at mccormick.cx
Thu Jun 6 08:06:48 CEST 2019

Hello Jakob,

On 13/3/19 1:36 am, Jakob Laue wrote:
> What is your experience with algorithmic sound/melody generation in Pd? 
> Do you know any algorithms? Have you heard of something or somebody who 
> is doing a lot with algorithms in Pd?

Not an academic, but one particular technique has been very fruitful for 
me. It works like this:

  * Establish a set of notes you want to use. E.g. 4-6 notes from a scale.

  * Set some random percentage (0% to 100%) of the note set to be 
null/rest note.

  * Create a random sequence of those notes e.g. 2 1 3 4 0

  * Have the sequence silently playing at several different rates over 
and over. So e.g. at normal rate, double-rate, half-rate, 3x rate. The 
length of each note can correspond to the rate at which it's playing 
(e.g. double-rate note will be half as long, half-rate note will be 
twice as long) or fixed for a different feel.

  * Now the trick is to have the sequence player randomly switch between 
these different rate sequences. So e.g. it might be playing the normal 
time track, then switch to the double-time track, then back to the 
normal, then to half, and this should be done randomly. It's good to 
stick with one rate for a few notes so make the switcher not too aggressive.

If you do this for a few bars and then loop the result you will get some 
nice melodic loops.

Playing with the note length live is a fun thing to do - set up a MIDI 
knob to control the note length of each note (either as a percentage of 
the default note length or as an absolute value) and then twiddle 
between a short pizzicato sound and a longer note. This can have a big 
effect on the mood.

I sometimes use this algorithm in real time on drum beats as well - 
manually switching normal, half, double-time versions of the beat - it's 
very pleasant to tinker with.

To educated musicians this may sound very naïve but I have found the 
mood of a melody to be highly influenced by the initial note selection 
and the rate of play.

In particular the mood "floating in the hybrid airship through the 
forest canopy to the treehouse algorave with lasers guiding the way" can 
be evoked with a simple modern mixolydian square-wave arpeggio and a 
little reverb.

Some of these techniques can be heard on the album I just released:


See the liner notes for details of the technology I used (including Pd).




Sign up to my newsletter to hear about tech I'm building.

More information about the Pd-list mailing list