Generating a melodic sequence starting from given chords.
nth-random, x-append , flat modules.
We will generate a note sequence starting from four CHORD objects as harmonic reservoirs. Each CHORD will contain a harmonical chord structure. We will use nth-random for choosing randomly notes from each reservoir sequentially.We will concatenate the result with x-append preserving the harmonical order of the reservoirs (I - IV -V - I).
A: Enter the desired harmony sequence in each of the CHORDs (A). In this example we used the tonal sequence of the I - IV - V- I degrees of C major scale (CEGC-CFAC-BFGD- CC).
B: Each nth-random (B) will randomly pick a note in the CHORDs reservoirs (A).
C: We will iterate 4 times this process using 4 repeat-n functions.
D: x-append (D) will concatenate all these repetitions in harmonicorder (i.e first we will have 4 randomly choosen notes from the first reservoir, then 4 from the second one etc...).
E: In order to have this harmonic sequence repeated twice, we will again use the repeat-n function (E). Notice that all these iterations yield different results due to the fact that we are using nth-random function which is at each iteration (on C and D levels)evaluated anew and therefore returning each time different results. Because repeat-n returns a list of two lists, flat will remove all parenthesis inside the list, and so will return a simple list where all elements are on the same layer.
The old version of this patch (in a patchwork version) was a gift to Camilo Rueda when he was at Ircam as a Patchwork developper. Just in order not to break the Colombian tradiction, this OM version is dedicated to Carlos Augusto Agon, an other nice Colombian guy working on Computer aided composition environments.
(Previously this patch was named salsa_1)