Demonstration 9 provided the second of two practical components for Chapter 11: “Musical Design II: — Grammars” of my unpublished textbook on composing programs. Like Demonstration 8, Demonstration 9 employs the method of generative grammars and also illustrates the principle of top-down design. This time, the productions divide regions of musical space into nested sub-regions.
The archetype for Demonstration 9 is described by extents along three axes.
The productions for Demonstration 9 progressively refine this description by dividing sections into sub-sections and then recursively treating each sub-section as a section in its own right. Figure 1 illustrates this process for measures 1-51 of Demonstration 9. Of the two kinds of production,
There are four binary modes and three ternary ones; each specific mode is distinguished by the proportions between subsection durations.
In order to project the grammatical structure clearly, no subsection exploits any registral or chromatic resource not already inherent in the section which produced it. To emphasize similarities between the two outer (a) subsections in ternary divisions, ternary productions pass identical resources to outer subsections. To emphasize differences between (a) and (b) subsections in both binary and ternary divisions, productions pass complementary resources to (a) and (b) subsections.
Each act of division deals with registers by dividing the section's extent into two overlapping subranges: a lower range covering the bottom two-thirds of the section extent and an upper range covering the top two thirds of the section extent. Which subrange goes to the (a) subsection is determined by a coin toss, the remaining subrange goes to the (b) subsection.
With regard to chromatic resources, each act of division derives two distinct (though overlapping) subsets from the set of chromatic degrees characterizing the section.
|Figure 2 (a): Figure 2: Transcription of Demonstration 9, page 1.||Figure 2 (b): Figure 2: Transcription of Demonstration 9, page 2.|
The following explanations seek to illustrate recursive grammars in play. The explanations are peppered with line numbers, but you are are by no means expected to chase down every line of code. Rather, you should follow through with line numbers only when you have a specific question that the narrative is not answering.
Figure 3 (a): Program
Since Demonstration 9 elaborates only one statement of its archetype, the main composing loop in
DEMO9 proper implements recursive processing. Variable names will be familiar
from Demonstration 8's subroutine
LEVEL tracks the level of recursion, iterating from the top down and back.
tracks horizontal progress, iterating from left to right in the time dimension.
Each iteration of
DEMO9's main loop (lines 23-49) begins by incrementing
IDX (line 25),
then testing if
IDX has reached the limit stored in array element
The value of
IDX is saved (“pushed”) into array element
IDX is retrieved (“popped”) from
For the present purpose,
IDX identifies a subsection either of the piece as a whole (the archetype) or of a
section at the previous recursive level. Sectional attributes are stored in multidimensional arrays indexed both by
DURLEV(IDX,LEVEL)holds the duration of subsection
RHGLEV(IDX,LEVEL)hold lower and upper boundaries, respectively, for a value which will ultimately define the lowest pitch in a twelve-semitone gamut.
NUMLEV(LEVEL)indicates how many degrees of the chromatic scale are to be exploited at the current level. The specific degrees exploited in subsection
IDXreside in array elements
Lines 20-26 of program
DEMO09 express the archetype by setting
DURLEV(1,1) to the duration of the composition,
values reflecting the range of the clarinet, NUMLEV(1) to 12, and
to the twelve degrees of the chromatic scale.
LEVEL=6, line 38 of
DEMO09 articulates consecutive sections with a rest
whose duration resides in array element
RSTLEV(LEVEL). Since the values of array
RSTLEV are static, they
are populated in line 13 of the
BLOCK DATA routine.
Remember that I termed Demonstration 9 an “architectural” grammar because notes are generated only at the
bottommost level of recursion. Note-generating requests are implemented as calls to subroutine
Productions for Demonstration 9 divide sections into subsections.
Implementing these productions boils down to populating values into
LEVEL+1 given values previously populated into these same arrays for
The code module responsible for this is subroutine
DEDUCE, which appears in Listing 3 (a) and
Listing 3 (b).
Listing 3 (a): Subroutine
Listing 3 (b): Subroutine
The first step in dividing a section into subsections is to choose a mode of division.
DEDUCE implements this choice in lines 15-29, which places the selected mode in the variable
There four binary modes and three ternary modes.
The number of sections for mode
IDIV is given by array element
CNTDIV(IDIV) while the duration of subsection
IDX is given by array element
FACDIV(IDX,IDIV). Since the contents of
FACDIV are static, both arrays are initialized in the
BLOCK DATA routine.
Subsection durations are expressed relative to parent section durations; that is why the values of
FACDIV sum to
unity for each mode of division.
BLOCK DATA routine initializes all elements of array
WGTDIV to unity,
but this array is not static. Here is the mechanism which prevents any one mode of division from being chosen more than once along
any vertical path one might trace down through the structure. Array element
WGTDIV(IDIV) holds the relative likelihood of
LEVEL=1, each element of
WGTDIV has its initialized value of unity.
Thus all modes have equal likelihood of selection. Should the choice for
be I, then I is populated into array element
cleared to zero (line 44 of program
DEMO09). This prevents mode I
from being reselected at any lower level. When the composing process retreats back to
) resets to unity (line 54 of
Line 21 of subroutine
DEDUCE dereferences the subsection count from array element
CNTDIV(IDIV) into variable
LCNT. The mechanism for selecting durations of subsections varies with LCNT
DEDUCEselects the variable
MOREto indicate the longer subsection while selecting the variable
LESSto indicate the shorter subsection. Understand that my library function
IRNDcalled in line 32 generates random numbers ranging from 1 up to the indicated argument. Thus
LESS=1with equal likelihood. Lines 34-35 dereference relative proportions from
FACDIV(2,IDIV), scale these proportions to the section duration, then distribute the results to subsections.
FACDIV(3,IDIV)holds the relative proportions which lines 40-42 scale to the section duration, then distribute to subsections.
Lines 47-71 of subroutine
DEDUCE compute subsection ranges as two-thirds of the section extent, positioned
either at the bottom or at the top. The library subroutine
SUCCES(P) implements a Bernoulli trial with output
values 0 (probability P) or 1 (probability 1-P). Having the probability set to 1/2 in line 48 means that which range (lower or upper)
goes with which subsection is decided by a coin toss.
Lines 76-136 of subroutine
DEDUCE allocates chromatic degrees to subsections. This process most
heavily favors those degrees which have been least exploited elsewhere in the piece.
The first step uses the library subroutine
marshal the current section's chromatic set into a preference order.
DSORT expects an integer array for argument 1, a real array for argument 2, and a
simple integer for argument 3. The integer array contains the values which will be sorted into descending order based
on preference values stored in the real array. Argument 3 indicates how many values to sort.
Remember that FORTRAN passes subroutine arguments by address rather than by value, so that what
to reorder the integer array remains valid in the calling routine.
) holds the total duration (in sixteenth notes) of all sections
in which degree I has been eliminated up to the current point in the composing process.
Line 82 sorts the current section's chromatic set into a preference order; however, using
directly for this purpose means that if two degrees share the same
CUMDEG value, then the sorting algorithm
will favor the degree with the lower chromatic number. To eliminate such favoritism, each
receives an increment generated randomly between zero and unity. Lines 77-81 store these adjusted sums in array
call DSORT(DEGSCD(1,IDX,LEVEL),FUZDEG,NUM) translates into English as follows: sort
NUM successive integers
starting with the address of
DEGSCD(1,IDX,LEVEL) into descending order based on the preference values stored in array
DSORT will receive the right content by understanding that FORTRAN stores the content of the multidimensional
array as a contiguous block of
MLEV integers, arranged in the following sequence:
DEDUCE populates chromatic degrees into array
depend both upon the recursive level and the mode of division.
Whenever a degree is excluded from a subsection, the corresponding
CUMDEG element increases by the subsection's duration.
LEVEL=5, all degrees in the schedule except for the last four are passed to all subsections. The remaining four degrees are dereferenced into variables
IDEG4in reverse4 order of preference.
IDEG2to the longer subsection while passing
IDEG4to the shorter subsection.
IDEG2to the outer (a) subsections while passing
IDEG4to the inner (b) subsection. Notice that the combined durations of (a) subsections is consistently at least as large as the duration of the (b) subsection.
IDEG4by the durations of the subsections where these degrees were not placed.
DEDUCEdereferences them into variables
IDEG2, in direct order of preference.
IDEG1passes down to the longer subsection, while
IDEG2passes down to the shorter subsection. Lines 126-127 increase the
IDEG1passes down to the inner (a) subsection, while
IDEG2passes down to the outer (b) subsection. Lines 132-134 increase the
As a result of this process, local chromatic distributions are very much non-uniform. However if you sum together the durations for each chromatic degree over the composition as a whole, the sums should be pretty much even.
|© Charles Ames||Original Text: 1984-11-01||Page created: 2017-03-12||Last updated: 2017-03-12|