Polyphonic Pitch Organisation

hey, i was wondering if somebody could share some code/ideas about organizing pitch. Most of the stuff I have seen is either relying on total/controlled randomness of diatonic scales, notates all the specific pitches which should appear in the piece or is not caring about pitch at all.
I dont necessarily mean in a baroc/classical/romantic style with a goal oriented pull from dominant to tonic but something which could lead to a greater musical identity in terms of harmony.
Does somebody has Code examples of polyphonic pitch organisation with L-Systems, Cellular Automata, composing with the overtone series like in french spectral music (for example gradually shifting from consonance to dissonance with adding odd partials) or Composing with DissonanceCurves? Any other ideas?
I also totally understand that a lot of music which is made in supercollider is concentrated on sound as a phaenomnea in itself, which probably is the definition of electronic composition.
“let sound be themselves”
thanks alot :slight_smile:

I’m pretty sure this is not what you are looking for, but here is an algorithmic mockup of the opening of the Ligeti fourth piano etude:

SynthDef("fanfares", {arg noteNumber, dur;
	Out.ar(0, SinOsc.ar(noteNumber.midicps,0, 0.1).dup*EnvGen.kr(Env.perc(0.01, dur), doneAction:2));
}).load(s);


(
var scale, scaleCounter, scalePattern, startingNote, eighthNoteDur, pulse, accent, noteVol, accentCount, bassNote, chordNotePattern,calculateRHNotes,calculateLHNotes, playChord, calcFunction, functionStream,startingNoteStream, lastNotes;

scalePattern = Pseq([2,2,1,1], inf).asStream;
scaleCounter = 0;

eighthNoteDur = 60/63/8;
startingNote = 48;
lastNotes = [0,0];

pulse = [3,2,3];
pulse = Pseq(pulse, inf).asStream;
accent = true;

chordNotePattern = Pseq(
	[Pseq([2,0,0,Pseq([1,1,1,1,0],4),0,0,0,0],1),
		Pseq([2,Pseq([1,1,1,1,0],3),1,1,1,1,1,1,0,0],1),
		Pseq([2,0,Pseq([1,1,1,1,0],2),1,1,1,1,1,0,1,1,1,1,1,1,1,0,0],1),
		Pseq([2,0,0,Pseq([1,1,1,1,0],2),1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0],1)], inf).asStream;


calculateRHNotes = {arg noteIn;
	var rhNotes, otherNotes, done;

	"rh".postln;
	done = false;

	while({done.not},{
		otherNotes = [[4,7], [5,9], [3,8]].choose;
		rhNotes = noteIn+12+otherNotes;
		if(0.5.coin,{rhNotes.put(0, rhNotes[0]+12)});
		if(rhNotes.sort[1]!=lastNotes.sort[1],{done=done.not},{"redo".postln;});
	});
	rhNotes
};

calculateLHNotes = {arg noteIn;
	var lhNotes, otherNotes, done;

	"lh".postln;
	done = false;

	while({done.not},{
		otherNotes = [[3,7], [5,8], [4,9]].choose;
		lhNotes = noteIn-24+otherNotes;
		if(0.5.coin,{lhNotes.put(0, lhNotes[0]+12)});
		if(lhNotes.sort[0]!=lastNotes.sort[1],{done=done.not},{"redo".postln;});
	});
	lhNotes
};

functionStream = Pseq([calculateRHNotes,calculateLHNotes],inf).asStream;
startingNoteStream = Pseq([48, 60, 60, 72], inf).asStream;

Routine({
	inf.do{
		bassNote = scaleCounter+startingNote;

		if (accent, {
			noteVol = 0.1;
			accent = false;
			accentCount = pulse.next;
			accentCount = accentCount-1;
			playChord = chordNotePattern.next;
			if(playChord==1, {
				lastNotes = calcFunction.value(bassNote);
				lastNotes.do{arg rhNote;
					Synth("fanfares", [\noteNumber, rhNote, \vol, noteVol, \dur, eighthNoteDur*3]);
			}},{
				if(playChord==2,{
					startingNote = startingNoteStream.next;
					bassNote = scaleCounter+startingNote;
					calcFunction = functionStream.next;
				});
			})
		}, {
			accentCount = accentCount-1;
			noteVol = 0.05;
			if(accentCount == 0, {accent = true});
		});

		Synth("fanfares", [\noteNumber, bassNote.postln, \vol, noteVol, \dur, eighthNoteDur]);
		eighthNoteDur.wait;
		scaleCounter = scaleCounter+scalePattern.next % 12;
	}
}).play;
)

Are you looking for composition strategies? If not, my answer will not be very useful :slight_smile:

E.g. in this piece, a markov chain is used to generate tonal functions, which then are realized as chords: Eternal Elevator Ensemble

Here’s an example of using L-systems for generating a kind of minimal music: Generating Graphics and Music From The Dragon Curve

If you look at this series of four articles, you will learn how to represent 2-voice harmonic progressions and voice leading as a kind of board game:

1 Like

Pfsm is the pattern class for producing finite state machines. I have not used it, but I have coded Markov chains from scratch in python and got some pretty promising results (using the freely available dataset of Bach’s complete works to train on). A quick search of sccode.org for “markov chain” or “cellular automata” yields several examples as well.

thanks for all the ideas. i will have a look :slight_smile: