Chapter 5
Random Selection II: Statistical Frames

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 ball-and-urn 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 twelve-tone 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 non-repetition rule is applied strictly. However, non-repetition 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 twelve-tone 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.

Synopsis

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.

Initialization

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 least-weighted option:

L  ≥  
1

minN j=1 wj

Which expression assumes that the weights wj 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.

Sampling

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.

History

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 pitch-selection 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. 175-178.

Commentary

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:

PitchE4F4G4A4B4C5D5
 Probability 0.0850.1550.1740.1730.1740.1550.085
 Denominator: 12 1/122/122/122/122/122/121/12
 Denominator: 34 3/345/346/346/346/345/343/34
Table 1: Pitch probabilities with ratio approximations.

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 denominator-12 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 12-member 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.

PositionLengthContentSummaryE4F4G4A4B4C5D5
048 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
Counts4888884
Proportions0.08330.1670.1670.1670.1670.1670.0833
012A4 D5 B4 F4 G4 F4 E4 C5 B4 A4 C5 G4Counts1222221
Proportions0.08330.1670.1670.1670.1670.1670.0833
612E4 C5 B4 A4 C5 G4|E4 F4 A4 B4 B4 C5Counts2112330
Proportions0.1670.08330.08330.1670.2500.2500
1212E4 F4 A4 B4 B4 C5 D5 G4 C5 F4 A4 G4Counts1222221
Proportions0.08330.1670.1670.1670.1670.1670.0833
1812D5 G4 C5 F4 A4 G4|A4 F4 A4 G4 C5 C5Counts0233031
Proportions00.1670.2500.25000.2500.0833
2412A4 F4 A4 G4 C5 C5 B4 G4 F4 E4 D5 B4Counts1222221
Proportions0.08330.1670.1670.1670.1670.1670.0833
3012B4 G4 F4 E4 D5 B4|B4 F4 G4 E4 C5 A4Counts2221311
Proportions0.1670.1670.1670.08330.2500.08330.0833
3612B4 F4 G4 E4 C5 A4 C5 D5 A4 F4 B4 G4Counts1222221
Proportions0.08330.1670.1670.1670.1670.1670.0833
Table 2: A 48-pitch sequence generated using the weights prescribed in the “Denominator 12” row Table 1.

Demonstration

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 play-rest 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: 2017-03-12 Last updated: 2017-03-12