Here is an explanation of the actual algorithm that controls desordre (this is taken from a doctorate thesis, I had to plow through this thing and it took me about a month before it stated to make sense) for the full thesis, google it:
Both foreground lines consist of cyclic repetitions of a constant step pattern. With each cycle, this pattern is transposed diatonically by a constant interval. The pattern for the upper part consists of 26 steps, 7 for each of the A phrases and 12 for phrase B. The pattern for the lower part has 33 steps, again 7 for each of the A phrases but this time 19 in the extended phrase B.
The contours of both patterns are highly similar, and especially the upper part, which could have easily been generated by a context-sensitive grammar, exhibits strong motivic features. In contrast to the lower part's pattern, whose B phrase extends by 2 bars beyond the expected 8 bars and ends in a whole note, however, the upper part's B phrase falls short by 2 bars and loops instantly back to its beginning.
There are overall 14 cycles in the upper part, each of which is transposed diatonically one step upwards and, due to its greater length, only 11 cycles in the lower part. The smaller number of cycles—which translates into fewer transpositions—is overcompensated for by a two-step diatonic transposition downwards and the fact that the lower part's pentatonic mode has fewer steps per octave than the heptatonic mode in the upper part. The cycles align with the score as follows:
Cycles:
Lower Part: Upper Part:
# Transp. Start # Transp. Start
=================== ===================
---------------------- Section I: -----------------------
1: ds3 2:1.0 1: b4 2:1.0
2: c5 2:2.7
2: as2 2:3.5
3: d5 2:4.7
3: fs2 3:2.2
4: e5 3:2.6
--------------------- Section II: -----------------------
4: cs2 3:4.4 5: f5 3:4.4
6: g5 3:4.11
5: gs1 4:1.3
7: a5 4:1.7
6: ds1 4:2.3
8: b5 4:2.5
7: as0 4:3.2
9: c6 4:3.3
10: d6 4:3.10
8: fs0 4:4.1 (1)
--------------------- Section III: -----------------------
4:4.7 11: e6 4:4.7
9: cs5 5:1.2
12: f6 5:2.4
10: gs4 5:3.7
13: g6 5:4.4
14: a6 6:2.4 (2)
11: ds4 6:2.4 (3)
The rhythmic picture is less clear due to rasterization effects in the acceleration and deceleration of the patterns. The sequence of rhythms in the upper and lower parts read as follows:
Rhythms Upper Part:
; ------------------------------; Sect. I Little Disorder
3 5 3 5 5 3 7 ; cycle 1
3 5 3 5 5 3 7
3 5 3 5 5 3 3 4 5 3 3 5
3 5 3 4 5 3 8 ; cycle 2
3 5 3 4 5 3 8
3 5 3 4 5 3 3 5 5 3 3 4
3 5 3 5 5 3 7 ; cycle 3
3 5 3 5 5 3 7
3 5 3 5 5 3 3 4 5 3 3 5
3 5 3 4 5 2 7 ; cycle 4 -- Speed-Up
2 4 2 4 4 2 5
2 3 2 3 3 1 1 3 3 1 1 3
; ------------------------------; Sect. II Rapid Accelerando [231 e]
1 2 1 2 2 1 3 ; cycle 5 -- start is in sync with cycle 4l
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 3 ; cycle 6
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 3 ; cycle 7
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 2 ; cycle 8
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 2 ; cycle 9
1 2 1 2 1 1 2
1 2 1 2 2 1 1 1 2 1 1 1
1 2 1 1 1 1 2 ; cycle 10
1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1
; ------------------------------; Sect. III Static [429 e]
3 5 3 5 5 3 8 ; cycle 11
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5
3 5 3 5 5 3 8 ; cycle 12 (same)
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5
3 5 3 5 5 3 8 ; cycle 13 (same)
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5
3 5 3 5 5 3 8 ; cycle 14
3 5 3 5 5 3 8 ;
3 5 3 5 5 8 ; cuts off here
Rhythms Lower Part:
; ------------------------------; Sect. I Static [404 e]
3 5 3 5 5 3 8 ; cycle 1
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 2
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 3
3 5 3 5 5 2 7 ; -- Speed-Up
3 4 3 4 4 2 2 4 4 2 2 3 2 3 1 3 3 1 4
; ------------------------------; Sect. II Rapid Accelerando
1 3 1 2 2 1 3 ; cycle 4 -- start is in sync with cycle 5u
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 3
1 3 1 2 2 1 3 ; cycle 5
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2
1 2 1 2 2 1 2 ; cycle 6
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2
1 2 1 2 2 1 2 ; cycle 7
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 1 1 1 2 1 1 1 1 1 1 2
1 1 1 1 1 1 2 ; cycle 8
1 1 1 1 1 1 2
1 1 1 1 1 1 1 1
; ------------------------------; Sect. III Allargando
5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 9
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 6 3 3 5 3 5 3 6 5 3 8
3 6 3 5 5 3 9 ; cycle 10
3 5 3 5 6 3 8
3 5 3 6 5 3 3 5 6 3 3 5 3 5 3 6 5 3 9
3 7 3 8 9 3 13 ; cycle 11
3 11 3 21
The Model
This analysis translates fairly straightforward into a model of the combined foreground structure. First, the tempo is set according to the specification in the score:
;;;
;;; Tempo
;;;
;;; Set as ration in order to work around floating point rounding problems
;;; in cm timing.
(defparameter *eigth-note-pulse* (rationalize (rhythm 'e (tempo 76 w))))
This cosmetic hack allows calls to make-item-stream to be embedded in item stream constructor macros.
;;;
;;; Allow the use of make-item-stream in constructor macros
(defprop make-item-stream :item-expand t)
Then an algorithm is defined for the upper foreground. As suggested by the anaylsis above, the algorithm is driven by four sets of data: the part's mode, its step pattern, its transposition pattern, and its rhythmic pattern.
;;;
;;; Upper Foreground
(defparameter *upper-mode* (transpose (mode white 2 2 1 2 2 2 1) 'c4))
(defparameter *upper-fg-steps*
'( 0 0 1 0 2 1 -1 ; Phrase a
-1 -1 2 1 3 2 -2 ; Phrase a'
2 2 4 3 5 4 -1 0 3 2 6 5)) ; Phrase b
(defun make-upper-fg-notes (start-note)
(intervals (make-item-stream 'items 'cycle *upper-fg-steps*)
from (steps 1 initially-from (modeify (degree start-note)
*upper-mode*))))
(defun make-upper-fg-rhythms ()
(items 3 5 3 5 5 3 7 ; cycle 1
3 5 3 5 5 3 7
3 5 3 5 5 3 3 4 5 3 3 5
3 5 3 4 5 3 8 ; cycle 2
3 5 3 4 5 3 8
3 5 3 4 5 3 3 5 5 3 3 4
3 5 3 5 5 3 7 ; cycle 3
3 5 3 5 5 3 7
3 5 3 5 5 3 3 4 5 3 3 5
3 5 3 4 5 2 7 ; cycle 4
2 4 2 4 4 2 5
2 3 2 3 3 1 1 3 3 1 1 3
1 2 1 2 2 1 3 ; cycle 5
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 3 ; cycle 6
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 3 ; cycle 7
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 2 ; cycle 8
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2
1 2 1 2 2 1 2 ; cycle 9
1 2 1 2 1 1 2
1 2 1 2 2 1 1 1 2 1 1 1
1 2 1 1 1 1 2 ; cycle 10
1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1
(items (items 3 5 3 5 5 3 8 ; cycle 11-14
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5)
for 3)
3 5 3 5 5 3 8 ; cycle 14
3 5 3 5 5 3 8
3 5 3 5 5 3 ; cuts off here
))
(algorithm upper-fg-mono midi-note ()
(vars (ntes (make-upper-fg-notes 'b4))
(rhys (make-upper-fg-rhythms)))
(setf note (unmodeify (item ntes) *upper-mode*)
rhythm (* *eigth-note-pulse*
(item rhys :kill t))))
The algorithm for the lower part foreground is driven by the same types of data. However, since it is eventually pitch-warped into the treble clef after it hit the bottom of the keyboard (4:4.7), its transposition pattern adds a warp function that shifts notes 5 octaves (i.e. 20 mode steps) up after 7 cycles, two 7-note phrases (A and A') and 4 measures of the B phrase (8 notes).
(defparameter *lower-mode* (transpose (mode black 2 3 2 2 3) 'cs4))
(defparameter *lower-fg-steps*
'(0 0 1 0 2 2 0 ; Phrase a
1 1 2 1 -2 -2 -1 ; Phrase a'
; Phrase b
1 1 2 2 0 -1 -4 -3 0 -1 3 2 1 -1 0 -3 -2 -3 -5))
(defun make-lower-fg-notes (start-note)
(let* ((cycle-length (length *lower-fg-steps*))
(warp-point (+ (* cycle-length 7) 7 7

))
(intervals (intervals (make-item-stream 'items 'cycle *lower-fg-steps*
:for 1)
on (items (items 0 for warp-point)
(items 20
in sequence
for most-positive-fixnum))
for cycle-length)
from (steps -2
initially-from (modeify (degree start-note)
*lower-mode*)))))
(defun make-lower-fg-rhythms ()
(items 3 5 3 5 5 3 8 ; cycle 1
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 2 (same)
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 3
3 5 3 5 5 2 7
3 4 3 4 4 2 2 4 4 2 2 3 2 3 1 3 3 1 4
1 3 1 2 2 1 3 ; cycle 4 starts in synch w/ cycle 5u
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 3
1 3 1 2 2 1 3 ; cycle 5
1 2 1 2 2 1 3
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2
1 2 1 2 2 1 2 ; cycle 6
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2
1 2 1 2 2 1 2 ; cycle 7
1 2 1 2 2 1 2
1 2 1 2 2 1 1 2 1 1 1 2 1 1 1 1 1 1 2
1 1 1 1 1 1 2 ; cycle 8
1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 5 3 3 5 3 5 3 5 5 3 8
3 5 3 5 5 3 8 ; cycle 9
3 5 3 5 5 3 8
3 5 3 5 5 3 3 5 6 3 3 5 3 5 3 6 5 3 8
3 6 3 5 5 3 9 ; cycle 10
3 5 3 5 6 3 8
3 5 3 6 5 3 3 5 6 3 3 5 3 5 3 6 5 3 9
3 7 3 8 9 3 13 ; cycle 11
3 11 3 21 ; cuts off here
))
(algorithm lower-fg-mono midi-note ()
(vars (ntes (make-lower-fg-notes 'ds4))
(rhys (make-lower-fg-rhythms)))
(setf note (unmodeify (item ntes) *lower-mode*)
rhythm (* *eigth-note-pulse*
(item rhys :kill t))))
At this stage, both foreground processes are implemented and may be listened to by issuing a
Stella [Top-Level]: mix upper-fg-mono,lower-fg-mono 0
Enhancements
A further improvement adds octaves and simulate the background layer:
;;;
;;; Add Octaves and a fake background.
;;;
;;; Background notes are "muted" when the foreground is active. To
;;; accomplish this, the names of the background containers must follow the
;;; foreground container names alphabetically. Local variables are set up
;;; to communicate information between containers.