So the code got a bit out of hand. A "Sectionator" object lays out MIDI sections of some length, and calls one of several "Generator" objects that return MIDI events for that section (repeated beats of a few random durations, a short-long beat pair of set duration, and silence). The generators are shuffled once used up, and are gone though a few (16) times. Pitch selection is slightly randomized, so
$ atonal-util ly2pitch "ees e aes bes b ees' e' aes' bes' b' ees'' e'' aes'' bes''" 51 52 56 58 59 63 64 68 70 71 75 76 80 82
got chopped up into pitch pairs, and each voice (there are only six as 80 and 82 were too high for my ears) switches periodically between one or the other of the pitches. So the lowest voice alternates between 51 and 52, the next 56 and 58, etc. There are generated silences of length 16 that help to (sometimes) offset the voices from one another (fake melody!), as well as some longer bits of silence.
Then you run it a few times until you get something somewhat presentable, add a bit of reverb, etc.
Or the code formalized and tested a bit more, but lacking in generators:
https://metacpan.org/pod/Music::Factory
tags #composition