The typescript for chapter 5 is provided in AutomatedComposition05.pdf.
The term statistical frames is my typescript's new name for an old practice. This practice was already known as “selection without replacement”. The words “without replacement” pay deference to Jacob Bernoulli's ballandurn paradigm, first introduced in Chapter 4. The difference from selection “with replacement” is that balls drawn out of the urn are set aside until the urn empties out, then replenished back into the urn. (Bernoulli himself recognized both modes of selection.)
I coined the term statistical frame to describe an artifact which arises out of the method, which is the set of consecutive decisions during which the urn contents deplete to nothing.
The most familiar musical example of selection without replacement is the twelvetone technique of Arnold Schoenberg. A basic premise of Schoenberg's technique is that all twelve degrees of the chromatic scale must be stated before any particular degree may be repeated. Thus music composed using this technique proceeds in frames of twelve notes during which the nonrepetition rule is applied strictly. However, nonrepetition does not apply over the ‘cusps’ (not my word) between frames: the composer is entirely free to begin a new frame with the precise degree that ended the previous frame.
The presence of these frames, and of the cusps that come between, begs musical interpretation. Should frames align with phrasing? Is there some sort of tension dynamic going on at the cusps, where the constraint against repeating a scale degree suddenly relaxes? Such questions bedeviled me when I first encountered twelvetone technique, and I believe my own perplexity is shared almost universally among composition students.
Viewed statistically, the effect of statistical framing is clear. It produces accurate distributions.
To implement the method of statistical frames requires arrays to hold the supply of distinct options (e.g. durations, dynamics, pitches), the weight associated with each option, and the pool which serves as the programmatic counterpart of the urn. The code has two phases, initialization and sampling.
The initialization phase corresponds to act of populating an urn. The pool size L should be large enough to accomodate at least one instance of the leastweighted option:
L ≥ 

Which expression assumes that the weights w_{j} sum to unity. If such is not the case, then the sum of weights should appear as the numerator.
To populate the pool array, generate L driver values equally spaced between zero and unity, then use a statistical transform to conform these driver values to your desired distribution.
The sampling phase excutes once for each attribute selection (e.g. to select a pitch for a note). An index indicates which pool element should next be selected; making a selection increments the index by 1 until the end of the pool is reached (the cusp). At that point the pool is shuffled randomly and the index wraps back to the beginning of the pool.
Knuth's Seminumerical Algorithms presents an algorithm for random shuffling on page 127. My “Catalog of Sequence Generators” treats the method of statistical frames on page 59, where it also reproduces the random shuffling algorithm from Knuth.
Call it statistical framing or selection without replacement, the practice is an established tradition for composing programs. The historical examples provided by Chapter 5 found publication in Automated Composition in Retrospect at the pages indicated: The pitchselection mechanism for Herbert Brun's 1964 Sonoriferous Loops is described on p. 172. Gottfried Michael Koenig's 1970 Übung für Klavier (generated using Project Two) is described on pp. 175178.
The selection model adopted in this chapter carries over once again from Gottfried Michael Koenig's Project Two. That is, the decisions pertaining to a specific musical attribute all draw from the same supply of options. Of the selection features which determine how to choose elements from the supply, two are pertinent to the present chapter:
Pitch  E4  F4  G4  A4  B4  C5  D5 

Probability  0.085  0.155  0.174  0.173  0.174  0.155  0.085 
Denominator: 12  1/12  2/12  2/12  2/12  2/12  2/12  1/12 
Denominator: 34  3/34  5/34  6/34  6/34  6/34  5/34  3/34 
The commentary for Chapter 4 revealed that while random selection with replacement comes over the long term to reflect the guiding distribution, the population sizes necessary for conformance are far larger than those typically encountered by composing programs. The alternative offered by selection without replacement reproduces the guiding distribution exactly over the course of each statistical frame. However the need to keep frame lengths short precludes fine distinctions of the sort enumerated in the “Probability” row of Table 1. Rather, the method requires discrete ball counts such as those offered by Table 1's “Denominator 12” and “Denominator 34” rows.
Applying the denominator12 row would institute the following process:
I have coded a process using the method of statistical frames to select pitches according to the “Denominator 12” row of Table 1. Results from this process are presented in Table 2. The first row of this table presents a full sequence of 48 pitches with an accompanying statistical analysis. Subsequent rows analyze 12member subsequences. Those starting in positions 0, 12, 24, and 36 align directly with the statistical frames. Unsurprisingly, their statistics conform to the “Denominator 12” row of Table 1: 1, 2, 2, 2, 2, 2, 1. The subsequences starting in positions 6, 18, and 30 bridge cusps between frames; here, conformance with the “Denominator 12” row is less agreeable. Granted, these discrepancies balance out over the longer term. Going back to the first row of Table 2, the statistics for the full sequence are precisely those indicated in the “Denominator 12” row.
Position  Length  Content  Summary  E4  F4  G4  A4  B4  C5  D5 

0  48 
A4 D5 B4 F4 G4 F4 E4 C5 B4 A4 C5 G4 E4 F4 A4 B4 B4 C5 D5 G4 C5 F4 A4 G4 A4 F4 A4 G4 C5 C5 B4 G4 F4 E4 D5 B4 B4 F4 G4 E4 C5 A4 C5 D5 A4 F4 B4 G4  Counts  4  8  8  8  8  8  4 
Proportions  0.0833  0.167  0.167  0.167  0.167  0.167  0.0833  
0  12  A4 D5 B4 F4 G4 F4 E4 C5 B4 A4 C5 G4  Counts  1  2  2  2  2  2  1 
Proportions  0.0833  0.167  0.167  0.167  0.167  0.167  0.0833  
6  12  E4 C5 B4 A4 C5 G4E4 F4 A4 B4 B4 C5  Counts  2  1  1  2  3  3  0 
Proportions  0.167  0.0833  0.0833  0.167  0.250  0.250  0  
12  12  E4 F4 A4 B4 B4 C5 D5 G4 C5 F4 A4 G4  Counts  1  2  2  2  2  2  1 
Proportions  0.0833  0.167  0.167  0.167  0.167  0.167  0.0833  
18  12  D5 G4 C5 F4 A4 G4A4 F4 A4 G4 C5 C5  Counts  0  2  3  3  0  3  1 
Proportions  0  0.167  0.250  0.250  0  0.250  0.0833  
24  12  A4 F4 A4 G4 C5 C5 B4 G4 F4 E4 D5 B4  Counts  1  2  2  2  2  2  1 
Proportions  0.0833  0.167  0.167  0.167  0.167  0.167  0.0833  
30  12  B4 G4 F4 E4 D5 B4B4 F4 G4 E4 C5 A4  Counts  2  2  2  1  3  1  1 
Proportions  0.167  0.167  0.167  0.0833  0.250  0.0833  0.0833  
36  12  B4 F4 G4 E4 C5 A4 C5 D5 A4 F4 B4 G4  Counts  1  2  2  2  2  2  1 
Proportions  0.0833  0.167  0.167  0.167  0.167  0.167  0.0833 
The practical programming content of Chapter 5 was provided by Demonstration 3: Statistical Frames. The outer loop of this program employs the method of statistical frames to select attributes for phrases: phrase duration, average note duration, articulation, and central pitch. The inner loop of the program uses the method of statistical frames to select a chooser for a playrest trial. It again uses the method of statistical frames to select an unscaled note duration (to be multiplied by the average note duration), and (for notes) a deviation around the central pitch.
© Charles Ames  Page created: 20170312  Last updated: 20170312 