Page  328 ï~~COUNTERPOINT COMPOSITIONS IN NON-TEMPERED SYSTEMS: THEORY AND ALGORITHMS Klaus Balzer Bernd Streitberg Leibnizstr.69 Alt-Moabit 90 D-1000 BERLIN 12 D-1000 BERLIN 21 F.R.G F.R.G ABSTRACT: We describe musical structures by the movement of points in a three dimensional lattice. The axes of this lattice correspond to the fundamental melodic steps of the proportional diatonic scale. The geometry of non-tempered music given by this lattice allows a straightforward algorithm for counterpoint compositions. The program generates polyphonic music automatically with a large bandwidth of musical styles ranging from early renaissance to late romantic music. 1.Introduction. Musical events can be investigated in two different scales of time: microtime and macrotime. Macrotime events conventionally are given in the musical score, where the smallest interval of time is about 25msec, the reaction time of a musician. Macrotime events are realized by rnicrotime signals with about 25psec, the reaction time of the cochlear membrane. We investigate a particular problem from -somewhat outdated- macrotime music: how to generate a polyphonic piece autcmatically. We believe, however, that the mathematics behind our tentative solution can be transferred to microtime structures also. Basically two approaches for automatic counterpoint have been proposed. The first grammatical approach emulates the monstrous system of academic counterpoint rules with the purpose of creating an "expert system" for polyphonic music. See STREITBERG[1988] for arguments against the expert systems hype from the viewpoint of computational complexity theory. The second approach views the counterpoint as a combinatorial optimization problem which can be solved by methods like sirmulated annealing, see for instance STREITBERG and BALZER[1988]. Here we present a third approach which is based on a geometrical representation of nontempered music. The movement of the single voices in a polyphonic piece is translated into the movement of points in a three dimensional lattice. The lattice corresponds to the fundamental melodic steps of the diatonic scale: s, 9,15Coun can be decribed, at least approximately, by a few simple rules governing the sequential and simultaneous movement of the different points. An APL2 program has been written in order to test the theoretical approach. The program has, we believe successfully, been presented at the "Chaos and Order" symposion in Graz, Austria 1989. 2.Lattices for non-tempered music. In our opinion, non-tempered music is more simple than the conventional tempered one if represented in the proper geometric setting. A three dimensional (Minkowski) lattice is the set of vectors x = aa + /3b + 7c, where, /3 and 7y E Z and a, b and c are linear independent vectors in R3. For simplicity of representation we always use the canonical basis of the R3. A lattice then can be viewed as a kind of three-dimensional "Squared paper" lCMC GLASGOW 1990 PROCEEDINGS 328

Page  329 ï~~Traditional proportional music is based on the numbers 2,3, 5. This means that the set of pitches is given by p = {2a3853Y}. In the fundamental lattice L1 we let x correspond to logp. The lattice L1 is called the spectral lattice, because it is especially useful for the description of sound spectra, where also higher dimensional lattices with further prime numbers 7,11,13 etc. could be used. The lattice used for harmonic analysis in diatonic music is called the chord lattice L2 and derived from L1 by a unimodular basis transformation a' 4, 3 - 3=,'- =. In the following paper, however, we will use the melodic lattice, whose base vectors a, b, c correspond to the following three basic melodic steps:", 91, the two different major seconds and a minor second (semi-tone). The following table gives several proportions together with the corresponding positions in the lattice (a, /3, y). Proportion a,3 y Proportion a, y 1/1 0 0 0 2/1 3 2 2 4/3 1 1 1 3/2 2 1 1 5/4 1 1 0 6/5 1 0 1 9/8 1 0 0 10/9 0 1 0 16/15 0 0 1 25/24 0-1 1 81/80 1 -1 0 81/64 2 0 0 100/81 0 2 0 256/255 0 0 2 45/32 2 1 0 27/20 2 0 1 320/243 0 2 1 25/18 1 2 0 32/25 1 0 2 512/405 0 1 2 160/81 2 3 2 256/135 2 2 3 256/243 -1 1 1 128/135 -1 0 1 The following figure represents a subset of the infinite lattice with the origin (0, 0, 0) corresponding to an arbitrary frequency, say 440Hz (a). The two cubes with bold lines in this figure contain an upper and lower tetrachord, say e-a and a-d'. The center and the two cornerpoints (0,0,0), (1,1,1) and (-1,-1,-1) are the fundamental pitches belonging to a cadence in a. While the idea to represent non-tempered music by lattices is very straightforward, we have found only one reference (MAZZOLA et.al.[1989]), using the basis 9, 2, 0..44414 -1-4 144 41 0'1004 - - 40 -100 000 -40-1I wO- f 1 - 0 I -',' - - 4. I ICMC GLASGOW 1990 PROCEEDINGS 329

Page  330 ï~~3. Rules for polyphonic compositions: Using the melodic lattice, it is possible to give a small set of fundamental rules by which a polyphonic composition can be generated. In these rules a movement is a step or jump from one point (x) to another one (y) in the lattice. A movement can be given by its difference vector y - x. RULE 1: Repetitions of movements are illegal Example:-(1,0,0)Â~(1,0,0)=(2,0,0) or x Ã~ - 8 -It should be noted that the sequence of major tone and minor tone ( x -s =. 4)is perfectly legal. Essentially it is the very existence of two different major seconds which makes nontempered music simpler than tempered music, where a simple rule like rule 1 could not be given. RULE 2: All time-reversible sequences of movements are illegal. Example: This is a very strict rule that can obviously be relaxed. It includes rule 1 as a special case. If a, b, c are upward melodic steps along the coordinate axes, rule 2 would allow only 6 different upward melodic movements (without jumps) exemplified by abcab. The same is true for downward movements. In a very strict interpretation of counterpoint, say for early renaissance music, it can be observed that rule 2 appears to be used also in the sense that upward (a) and downward (-a) are identified. It is then not possible for a melodic line to return to its starting point without using jumps. RULE 3: All movements are illegal with components absolutely larger than 1 Also movements with absolute differences larger than 1 are considered illegal. This rule governs jumps. All legal movements therefore.are contained in the double cube (marked with bold lines) centered around the initial point. In a more relaxed set of rules also jumps into cubes farther away can be made legal. RULE 4: If several voices move simultaneously, their movements have to be different from each other, where upward and downward movements are identified. This is obviously a generalization of the rules governing parallel movements. If an additional rule is postulated whereby only "consonant" proportions are allowed (in the traditional sense of consonance) rule 4 would allow only parallel thirds and sixths, because here at least two different "thirds" and two different "sixths" exist. RULE 5: Two voices attacking at the same time have to form a "consonant" proportion. The definition of "consonance" here is essentially open and can be varied from composition to composition. These rules suggest to the composer the following strategy: shift the attack points of the different voices such that simultaneous attacks only occur at a few given points of time, where consonances are desired. In this way dissonances are possible and the polyphonic composition will be more lively. In our composition program we therefore use the rhythmic structure as the basic control element. RULE 6: If several movements are legal, the "smallest" of them is preferred. Again we leave it essentially open how the "size" of a move is defined. In practice we often use smallness in the sense of "small" frequencies, i.e. i6<10 <92 etc. If movements are restricted to points in the double cube and consonance is defined in the traditional way, the composition will be strongly related to early renaissance music. If one augments, however, the f'indamental vocabulary of consonances and allowed steps, without violating rule 1, the musical material becomes richer and can include pieces in the late romantic style. 4. The composition program. The program has been written in the language APL2. Because APL2 is not well known to musicians, a few remarks why we believe this language to be of importance are necessary. ICMC GLASGOW 1990 PROCEEDINGS 330

Page  331 ï~~" The basic data structure is a multidimensional array, whose elements are numbers, characters or multidimensional arrays. This is a very rich primitive data structure which generalizes the one-dimensional list structures of LISP or PROLOG to multidimensional list structures. Data structures can have an independent existence and can directly be looked at and changed in the global environment. " There is a rich set of "structural" functions which allow one to manipulate these arrays without regard to the nature of their elements. Examples are reverse, rotate, restructure, select, take, drop etc. There also is a rich vocabulary of "pervasive" functions manipulating the scalars contained in the argument arrays. For instance a = b is a 0-1-array comparing conformable arrays a, b "elementwise". " Besides arrays and functions there exist so called operators which take functions and deliver new functions. This two-level approach to functional programming avoids many of the difficulties and pitfalls of LISP-like languages. User defined functions and operators behave exactly like primitive ones. " The use of both infix and prefix function allows a concise notation without a flood of parentheses. Furthermore there is no precedence hierarchy between different functions which makes live much simpler than in C. " Implementations like STSC-APL PLUS 11/386 have a very powerful and efficient development environment with seamlessly integrated editors, graphics, file systems etc. Once a basic musical language has been developed, using freely cooperating user defined functions and operators, most tasks can be solved without any further programming at all. These are the basic components of the program: 1. The rhythm structure determines the attack points of the voices. This is a 0-1 matrix with rows for quantisized time points and columns for the voices. 2. Voices move in a lattice of dimension 24 x 16 x 16. This is sufficient for 8 octaves. The points of the lattice correspond to pitches, where a basic pitch can be chosen, say (0,0,0)=25 Hz. In this lattice a binary filter can be given by entering 0 for disallowed pitches. The rules given in section 3 of this paper can be viewed as further filters that restrict the movements of the voices. 3. All voices attacking at the same point of time are compared. Only consonant proportions are allowed for a given voice. 4. The "linear" movements in each voice are represented in a local 3 x 3 x 3-lattice according to rules 1-3. 5. Finally the voices can be played on an instrument that allows free choice of frequencies. If this is not possible, frequencies(f) can be approximated by MIDI note values(x) via x = [(69.5 + 12 log2 440)J. Here the non-tempered representation is used for tempered music like complex numbers are used in mathematics in order to obtain real results not obtainable otherwise. Analogous approximations can be given for microtonal instruments, where we consider a 53 step equal temperature as especially suited because it is based on an approximation of the syntonic comma (u). Examples will be presented at the conference. 5. References STR.EITBER.G,B. and BALZER.,K.[1988]: The sound of mathematics. Proceedings of the 14th International Computer Music Conference Cologne 1988. 33, 158-165 STR.EITBERG,B. [1988]: On the non existence of expert systems--Critical remarks on artificial intelligence in statistics. Statistical Software Newsletter. 14, 55-74 MAZZOLA,G., WIESER.,H.G., BR.UNNER.,V., MUZZULINI,D. [1989]: A symmetry oriented mathematical model of classical counterpoint and related neurophysiological by depth EEG. Computer Math. Applic. 17, 539-594 ICMC GLASGOW 1990 PROCEEDINGS 331