Hello,
currently I’m not generating melodic structures with SC but miSCellaneous_lib contains some classes that can be used for that purpose.
(1) PSrecur for recursive operations can be used to do developing variation (in wide interpretation of Brahms and Schoenberg): in this example it’s only applied to melodies, but of course this can be extended to groups of motifs, chords, rhythms etc.
(
a = (60..71);
b = (75..86);
// randomly exchange one pitch of array
p = PSrecur({ |x|
x[0][(0..2).choose] = (a.asSet - x[0].asSet).choose;
x[0]
// random start
}, 1, start: [a.scramble[0..2]]);
q = PSrecur({ |x|
x[0][(0..4).choose] = (b.asSet - x[0].asSet).choose;
x[0]
}, 1, start: [b.scramble[0..4]]);
x = Pbind(
\dur, 0.2,
\midinote, Pseq([p.trace.flatten, q.trace.flatten], inf)
).play
)
x.stop
(
x = Pbind(
\dur, 0.2,
\midinote, Pseq([p.trace.flatten, (p + 12).trace.flatten], inf)
).play
)
x.stop
(2) The method ‘enum’ can be used to find melodies of same shape, which can be used for variations, an idea of Fabrice Mogini). See Ex.2 of the enum help file.
(3) Idev suite – from its tutorial file: “DIdev / PIdef / PLIdev search for numbers with integer distance from a source signal / pattern up to a given deviation. Repetitions within a lookback span are avoided, DIdev / PIdef / PLIdev randomly choose from possible solutions. Intended for search within integer grids (pitches, indices etc.), however applications with non-integer sources are possible, see examples.
The main musical idea of these classes is, that it’s often unwanted to have certain characteristics repeated within a perceptional time window. This might apply to melodic lines as well as to rhythmic patterns or sequences of timbre and can be continued in the domain of microsound. The principle can easily be understood with pitches, therefore most examples are of this kind.”
A rewrite of some old programs which I used for instrumental pieces back then, e.g. this one for accordion and string trio. The described principles were used with a mode on changing roots.
https://www.daniel-mayer.at/werke/line-step-phrase_en.htm
The algos were applied in an amotivic way, but this can be done differently with Idev classes (Idev could e.g. run over indices refering to motifs).