You are on page 1of 8

Score Generation in Musical Orbifolds

Michael Gogins gogins@pipeline.com Irreducible Productions Abstract


Common principles of voice-leading can be represented using orbifolds in which each point is a chord, and the smoothness of voice-leadings corresponds to the closeness of their chords in the space (Tymoczko 2005). The set of such voice-leadings for the major and minor triads includes the Tonnetz. It is natural to use related orbifolds for all trichords, higher arities of chord, and so on. The present work demonstrates the use of such orbifolds as spaces for algorithmic composition. A Lindenmayer system takes an axiom and symbol replacement rules, and recursively rewrites the axiom by applying the rules. A turtle that represents a chord moving within a musical orbifold then interprets the symbols in the nal production of the Lindenmayer system as commands for writing a score. This shows how score generators can work in mathematical spaces that have specically musical structure. Recently, I chanced across Dmitri Tymoczkos work on the geometry of musical chords. I believe this goes some distance towards imbuing mathematical spaces with inherent musical structure, and I think these spaces could be used by a variety of mathematically based compositional algorithms. The present work demonstrates such an algorithm, a Lindenmayer system that generates scores by moving a turtle representing a chord about in two related musical orbifolds.

Musical Orbifolds

Introduction

The use of algorithms to generate musical scores is as old as computer music (Hiller and Isaacson 1959). Today there are many methods of algorithmic composition (Burns 1993). I categorize them as either grammatical, i.e. based on some kind of generative grammer, or mathematical, i.e. based on mathematical operations or forms such as fractals. Some notable examples of grammatically-generated pieces are the works of David Cope (Cope 1991; Cope 1996; Cope 2000); of mathematically-generated pieces, Viola Elegy (Dodge 1994) and Gendy 3 (Xenakis 1995). To my taste, the mathematical algorithms are the more musical, yet I nd them difcult to control with respect to harmony and counterpoint, whether in the traditional sense, or in the more general sense of having large-scale pitch structure and being well-formed. I do hear productions from grammatical algorithms that are harmonically and contrapuntally quite well-formed; yet to me, somehow, they never sound very original. Consequently, I have long searched for a means of imparting specically musical structure to the abstract spaces used by mathematical algorithms.

An orbifold is a quotient space whose points are equivalent under some group action (any combination of translation, rotation, glide rotation, and reection) that denes a symmetry. In other words, the group action permutes the corners of the orbifold, thus gluing the faces of the quotient space together. For example, a strip of paper is a quotient space of the plane; gluing two ends together creates a ring, which is an orbifold. Giving the ends a half twist before joining them creates a Moebius band, another orbifold. Dmitri Tymoczko (Tymoczko 2005) introduced an orbifold that divides chord space by the product of the symmetry of pitch-class sets times the octave: Rn / (Sn (12Zn )), which could be called the completed Tonnetz. Its fundamental domains are n 1 dimensional simplexes. The vertices of the orbifold are identied by a group action that consists of a rotation (for odd dimensions) or a rotation plus a reection (for even dimensions). Figure 1 shows this completed Tonnetz for trichords. The lines connecting chords indicate movements of one semitone, so that joined chords are closest neighbors and the lines indicate all minimal voice-leadings. Tymoczko and colleagues (Callender, Quinn, and Tymoczko 2006) are using this approach to recast music theory in geometric form. The classical Tonnetz of Oettingen, Euler, and Reimann is simply the six columns of major and minor triads surrounding the central column of 4 augmented triads parallel to the orthogonal axis of the space; the augmented triads also dene the axis of symmetry of the orbifold. One end of the prism can also be visualized as being rotated 120 and glued to the other end to form a torus.

Ranged chord A set of one or more distinct notes sounding at strictly the same time, but where the voices are constrained to lie within a nite tessitura; i.e. a chord under range equivalence. Unordered chord A chord that does not distinguish order of voices; i.e. a chord under permutational equivalence. (60, 64, 67) and (67, 64, 60) are equivalent to the unordered chord {60, 64, 67}. Voices are always listed in ascending order of pitch. Pitch-class set A chord under both octave equivalence and permutational equivalence. The three chords mentioned above are all equivalent to the pitch-class set {0, 4, 7}. Inversion A reection of a pitch or set of pitches; i.e. inversional equivalence. {Eb, G} is equivalent to {Eb, Cb}. The music theorists sense of inversion. Figure 1: Tonnetz for trichords As a generalization of the Tonnetz, R3 / S3 12Z3 illuminates basic symmetries and constraints of Western music. The major and minor triads are so exible with respect both to harmonic progression and voice-leading because they not only lie near each other, but also surround the orbifolds axis of symmetry. Similarly, for tetrachords, commonly used seventh chords surround the orthogonal column of diminished seventh chords. Tymoczko also denes a normlike size for voice-leadings, rst by smoothness (distance between chords in the Tonnetz, using either the taxicab norm or the Euclidean norm), and then by parsimony (fewer or shorter movements of voices). My approach here is inspired by Tymoczkos work, although I derive some additional orbifolds in order to represent specic operations I require for score generation. Permutation A permutation of a set of pitches or pitch-classes. The musicians sense of inversion. Normal chord An unordered chord rooted in the rst octave (not to be confused with normal form). {0, 4, 7}, {4, 7, 12}, and {7, 12, 16} are all equivalent to the normal chord {0, 4, 7}, or the C major triad. But the F major triad is the normal chord {5, 9, 12} not {0, 5, 9}, which is its pitch-class set. It is arbitrary what permutation is chosen as normal. Here, it is dened as that permutation which is closest to the orthogonal axis of chord space. For trichords this is root position, for other arities it may or may not be root position. Voicing A chord produced from a pitch-class set by adding or subtracting octaves from one or more voices, and/or permuting the order of voices. Each voicing of a chord has the same pitch-class set, but all else may differ.

2.1

Denitions

2.2

Related Orbifolds for Musical Representation

Note A sound that has a denite continuing pitch. Middle C is the note C4 (or 60); C above middle C is another note, C5 (or 72). Chord A set of one or more distinct notes sounding at strictly the same time, distinguishing octave, range, permutation, inversion, and transposition. (60, 64, 67) is a chord. (64, 67, 72) is a different chord. (67, 64, 60) is a different chord. Pitch-class A pitch that does not distinguish octaves; i.e. a pitch under octave equivalence. C4 and C5 are equivalent to the pitch-class C (or 0).

In the present work, musical scores are represented as functions of time onto chord space. Arpeggios, passing tones, counterpoint, and so on are considered to be composed of more or less eeting or elaborated chords. Chords are represented as points in a linear chord space, which has one dimension of pitch per voice, distinguishing inversions, octaves, and order of voices. This space extends up and down to innity from a reference pitch at the origin. Chord space is continous, and every equally tempered and non-equally tempered chord can be dened in it. Other properties of music may also, for convenience in implementing algorithms, be represented as additional, higher dimensions of chord space. For example, three dimensions

(0, 1, 2) sufce to represent the pitches of a trichord. Three more dimensions (3, 4, 5) may be used to represent the respective loudnesss of the voices. Dimensions (6, 7, 8) may be used to represent the durations of each voice in the chord. And so on. Throughout the present work, pitch will always be represented in the lower subspace, and it is this subspace that will be meant when referring to chord space even if additional dimensions are in fact used to represent music. Some other basic musical objects and operations can then be represented by one or another orbifold within chord space. The vital point is that for each music-theoretic equivalence class (e.g. octave equivalence, permutational equivalence, inversional equivalence, transpositional equivalence), and for each combination of equivalence classes, there is a corresponding orbifold in chord space. The equivalence relations dene which corners of the space are identied to form the orbifold (Callender, Quinn, and Tymoczko 2006). 1. To repeat, chord space represents n voices of any range, any octave, or any order of voices: it is simply Rn , i.e. n-dimensional Euclidean space. 2. Ranged chord space (Figure 2; augmented triads are white, major triads red, minor triads blue) is chord space under range equivalence: Rn /T Zn . This corresponds to one what might think of as the pitch space of a score with a certain number of voices, each having the same range. Voices dropping off the bottom of the score reappear at the top. 3. Voice-leading space for ranged pitches (Figure 3) is chord space under both range (perhaps > octave) and permutational equivalence: Rn / (Sn (T Zn )). The additional columns of triads reect the fact that chord voicings must distinguish different octaves. 4. Voice-leading space for pitch-class sets is Tymoczkos completed Tonnetz, Rn / (Sn (12Zn )), discussed above (Figure 1; one end of the prism can also be visualized as being rotated 120 and glued to the other end to form a torus). Figure 4 shows the Tonnetz for trichords embedded in ranged chord space.1 5. Normal chord space is chord space under both p31m equivalence and range equivalence; for trichords, it is R3 / p31m 36Z3 . The wallpaper group p31m identies the fundamental domain by dividing the equilateral fundamental domains of the Tonnetz into 3 kites, one of which consists of normal chords. For other arities of chord, I do not know the exact group for each
1 Although I dene other orbifolds here for convenience in implementing compositional algorithms, only the completed Tonnetz represents the voiceleading relationships between pitch-class sets both irreducibly and unambiguously.

Figure 2: Ranged chord space for 3 voices, 2 octaves

Figure 3: Voice-leading space for 2 octaves of trichords

Figure 6: Normal chord space for trichords embedded in voice-leading space Figure 4: Tonnetz for trichords embedded in ranged chord space arity, but I think its fundamental domain can be identied with the rst permutation of the symmetric group for the chord, Sn . Figure 5 shows normal chord space, the kite closest to the orthogonal axis (the ends of the kite can also be visualized as being glued together [without rotation] to form a torus). Figure 6 shows normal chord space embedded in voice-leading space. space, a chord transposition is simply a translation along the orthogonal axis of the quotient space. In the Tonnetz for trichords this translation is performed without distinguishing the inversion of the chord. For example, starting with the major triad {3, 1, 4} and progressing upwards by semitones, the triad will move step by step up one column of major triads (root position), then rotate 120 to the second column (rst inversion) and divide by the modulus of the space to appear at the bottom of the column and move step by step up that column, then rotate 120 to the next column (second inversion) and divide to appear at the bottom of the column to move step by step up that column. Hence the sequence of all major triads is as follows, using the actual coordinates (to get the pitch-classes, take these coordinates modulo 12): {-3, 1, 4} {-2, 2, 5} {-1, 3, 6} {0, 4, 7} {-3, 0, 5} {-2, 1, 6} {-1, 2, 7} {0, 3, 8} {-4, 1, 5} {-3, 2, 6} {-2, 3, 7} {-1, 4, 8} Figure 5: Normal chord space for trichords Both in the Tonnetz for trichords and in normal chord In normal chord space, on the other hand, the chord moves step by step up the column of 12 major triads and then is

divided by the modulus of the space to begin again at the bottom of the same column, so the sequence of triads is: {0, 4, 7} {1, 5, 8} {2, 6, 9} {3, 7, 10} {4, 8, 11} {5, 9, 12} {6, 10, 13} {7, 11, 14} {8, 12, 16} {9, 13, 17} {10, 14, 18} {11, 15, 19} One reason polyphonic music works is that a single pitchclass set can have permutations that lie far apart in the Tonnetz, yet different pitch-class sets can have permutations that lie near each other. Thus composers switch back and forth between thinking of pitch-class sets and thinking of their permutations, in order to discover paths through the Tonnetz that are both interesting harmonically and smooth contrapuntally. As an example of such operations performed in different orbifolds, the following steps implement the common compositional moves of beginning with a known source chord, choosing a progression to a target pitch-class set, and nding the target chord that provides the closest voice-leading from the source chord to the target pitch-class set: 1. The source chord is a point in ranged chord space. 2. Reduce the source chord to its pitch-class set, then invert it (in the musicians sense, by moving its lowest voice up an octave) till it is closest to the orthogonal axis of chord space, to locate the source in normal chord space. 3. The progression between every pair of chords in normal chord space is a specic translation. Perform the translation that produces the desired progression. For example, the V-I progression is produced by moving 7 units orthogonally down the colum of major triads in normal chord space, e.g. A to D is {9, 13, 16} {7, 7, 7} = {2, 6, 9}. The ii-V progression is produced by moving 5 units orthogonally up the column of minor triads, then moving 1 unit up in the 2nd voice to change the chord to a major triad. 4. The target has now been obtained in normal chord space. Find the best voice-leading from the source chord to the target pitch-class set in ranged chord space. As long as the voice-leading does not need to be done in real

time, an exhaustive search and comparison of all bijective voice-leadings in ranged chord space is practical, and that is the algorithm used here: (a) Store the source chord and target pitch-class set. (b) Generate the lattice of points within ranged chord space that have the target pitch-classes, by iterating through all points in the space and storing the matching chords. (c) Compare each voice-leading from the source chord to a potential target, rst by smoothness, then by parsimony, optionally excluding parallel fths. (d) Return the closest target chord. I am not claiming that musical orbifolds model all nuances of the musical ear and highly developed musical styles. My point is simply that mathematical spaces can be imbued with musical structure such that simple operations in those spaces have intrinsic musical intelligibility there is no need for the further step of an arbitrary mapping from the mathematical results onto musical semantics. I will return to this point later.

Lindenmayer Systems

Lindenmayer systems are recursive functions that rewrite strings (Prusinkiewicz and Lindenmayer 1991). Each Lindenmayer system consists of an axiom or initial string of atoms, a table of rules each specifying how one atom is to replaced with a string of atoms, an implicit rule that an atom with no replacement is replaced by itself, and the number of iterations for the recursion. In addition, some of the atoms of the system are commands for a turtle in a turtle graphicslike system. For example, F might mean move one step while drawing a line, f move one step without drawing a line, + turn right, - turn left, [ push the turtle state onto a stack, and ] pop the turtle state from the stack (pushing starts a branch; popping returns the turtle to the branching point.) The Lindenmayer system is iterated a the specied number times. Repeated replacements usually expand the initial axiom into a very long string of atoms, called the production of the system. The production is then interpreted as a program for the turtle, which draws a gure in the space.

3.1

OL Lindenmayer Systems

In the simplest type of Lindenmayer system, or OL system, also called context-free, the replacement rules do not depend on the state of the production on either side of the current atom, and do not take parameters.

OL systems have already been used for some time to generate musical scores in spaces where time is one dimension of the space (Holtzman 1981; Gogins 1992; McCormack 1996). Adapting OL systems to generate scores in chord spaces, where each dimension of the space is a voice and time is simply the sequence of chords, was straightforward. I implemented the score generator using Python (van Rossum 2006), the SciPy package which provides efcient matrix arithmetic for Python (Oliphaunt, Peterson, and at al. 2005), and CsoundVST, an extended version of Csound 5.0 with Python scripting and some facilities for mathematically-based algorithmic composition (Vercoe, ftch, et al. 2006).

3.2

An OL Lindenmayer System for Musical Orbifolds

In an n-dimensional space, the turtle can be dened as a position vector, the step as another vector, movement as adding the step vector to the turtle vector, and rotation as multiplying the step vector by a rotation matrix, so that the step points in a new direction. In the present work, the turtle moves in an n-dimensional quotient space with a group action. Sometimes the turtle is moving voicewise in ranged chord space (V commands), and sometimes it is moving chordwise in normal chord space (P commands). Because each operation is dened on one or another orbifold of chord space, all operations can actually be performed on points in chord space alone, using ordinary matrix arithmetic. Each orbifold is dened by the specic modulus which produces the group action that glues the faces of its quotient space together. Time is dened as the sequence of chords, and the turtle state includes the size of the time step (T commands). Table 1 summarizes the turtle commands.

Generating a Piece

The Pv and Cv turtle commands shown in Table 2 set up a C major chord, then create a IM7 ii7 V7 VIM7 progression (Figure 7).

Figure 7: Progression A sequence of these progressions can be created using a simple Lindenmayer system with one substitution rule (Table 3, Figure 8). Note the smooth voice-leading. Table 4 and Figure 9 show how the V commands can move voices one at a time to produce arbitrary counterpoint. In the

Chord Creation Ca Write chord at current absolute position of turtle in ranged chord space. Cv Write chord with turtles pitch-classes, but at smoothest voice-leading from prior chord. D7b9) at Ccname Write jazz-named chord (e.g. smoothest voice-leading from prior chord. Size of Turtle Step S*x Multiply step by x. S/x Divide step by x. S=d, x Assign x to dimension d of step. Add x to dimension d of step. Sad, x Ssd, x Subtract x from dimension d of step. Multiply dimension d of step by x. Smd, x Sdd, x Divide dimension d of step by x. Orientation of Turtle Step O+a, b Rotate turtle step by A from dimension a to b. O-a, b Rotate turtle step by A from dimension b to a. Voice Movement Vf Move turtle one step in ranged chord space. V=d, x Assign x to dimension d of turtle. Vad, x Add x to dimension d of turtle. Vsd, x Subtract x from dimension d of turtle. Vmd, x Multiply dimension d of turtle by x. Vdd, x Divide dimension d of turtle by x. Progression of Chords Pvv Move turtle v by adding a vector v to it, v0 , .., vn . P=d, x Assign x to dimension d of turtle position in normal chord space. Pad, x Add x to dimension d of turtle position in normal chord space. Psd, x Subtract x from dimension d of position in normal chord space. Pmd, x Multiply dimension d of turtle position by x. Pdd, x Divide dimension d of turtle position by x. Pcname Set voices of turtle to jazz-named chord (e.g. D7b9) at smoothest voide-leading from prior state of turtle, without sounding. Tempo T=x Assign x to time step size. Tax Add x to time step size. Tsx Subtract x from time step size. Multiply time step size by x. Tmx Tdx Divide time step size by x. Branching [ Push turtle state on stack (branch). ] Pop state off stack (return to branching point). Table 1: Turtle Commands

Iterations Axiom

1 C=CM7 Cv Pv1,2,1,2 Cv Pv5,5,5,6 Cv Pv2,2,3,2 Cv Table 2: Progression

Iterations Axiom Replace B

Iterations Axiom Replace A

1 C=CM7 A A A Cv Pv1,2,1,2 Cv Pv5,5,5,6 Cv Pv2,2,3,2 Cv Table 3: Sequence

2 C=CM7 B Td1.125 Cv Va0,2 Cv Va1,3 Va2,2 Cv B Vs3,4 Cv B Va0,2 Cv Va1,3 Va2,4 Cv Va3,3 Cv Cv Tm1.125 Table 4: Independent Voices

Lindenmayer systems interpreter, voices with the same pitch in different chords are tied. In this system, the replacement rule for B itself includes references to B, so that 2 iterations cause a recursive expansion of the motive. The T commands also cause the 2nd replacement to move at a faster tempo. Finally, Table 5 represents the Lindenmayer system for a piece of 3 minutes 45 seconds. The axiom creates a major 7th chord, then species an ABB A form. The [ and ] commands push and pop the turtle state from a stack, so that the chord appearing before [ re-appears after ]. The A section is constructed from the Table 3 sequence above, as well as another similar sequence. The B section consists of the independent voices section described in Table 4, recursively constructed at faster and faster tempos. In the B section, one of the voices is moved before rule B is applied, which affects all subsequent voice-leading. At the ends of the A, D, and F sections, the E section generates arpeggiations within some chords. The score, code, and output from this piece can be found at http://www.ruccas.org/index.php?Michael Gogins.

Figure 9: Independent Voices

Iterations Axiom

5
5.1

Discussion
Limitations
Replace A Replace B

This approach does know something about voice-leading; but nothing about counterpoint proper, imitative procedures, Replace D Replace E

Replace F

3 C=CM7 A Cv Cv [ B Cv Cv [ Pv0,1,0,1 B Cv Cv Cv Cv ] ] A Cv Cv F F E D D E F E Cv Cv Td1.125 Cv Va0,2 Cv Va1,3 Va2,2 Cv B Vs3,4 Cv B Va0,2 Cv Va1,3 Va2,4 Cv Va3,3 Cv Cv Tm1.125 Cv Pv1,2,1,2 Cv Pv2,3,2,3 Cv D Cv Cv [ Td2. Vs3,12 Ca Vs2,12 Ca Vs1,12, Ca Vs0,12 Vs1,12 Vs2,12 Vs3,12 Ca E Tm2. ] Cv Cv Pv1,2,1,2 Cv Pv5,5,5,6 Cv Pv2,2,3,2 Cv F Cv Table 5: Sample Piece

Figure 8: Sequence

tonal key, or serial procedures. These orbifolds always represent a xed number of voices, though dropping voices can be simulated by doubling or silencing some (Figure 9). The voice-leading algorithm is not exible, and always brings the target chord into the same range as the source. In other words, exercising basic movements within musical orbifolds does not model the ne points of musical hearing, or model any existing musical style.

5.2

Strengths

Recursive patterns of movement in chord space can easily create top-down, hierarchical pitch structures. The Lindenmayer system presented here can focus, as it were, on counterpoint by using the V commands to directly control the movements of the independent voices, or it can focus on harmony by using the P commands to directly control the progression of the chords, with or without connecting them smoothly through the voice-leading algorithm. Although as noted these procedures do not model sophisticated hearing or particular styles, they do remove the need for an additional layer of musical interpretation that in my judgment tends to obscure the formal integrity of generated scores. As a result, I feel that the present approach sounds purer. Finally, this purely geometric approach to chords and voiceleading opens the composition of pitch structures up to all the resources of mathematics.

5.3

Future Directions

The mathematics here is concise, yet these spaces could support many other compositional algorithms, such as chaotic dynamical systems, applying musical lters to images or scientic data, Xenakis sieves or other stochastic generators, and so on. It would of course be nice to have a equally succinct way to represent changing numbers of voices. The musical orbifolds presented here represent very basic, obvious aspects of musical structure. One wonders whether other spaces could be designed, or discovered, that could perhaps bear equally simple and useful, yet less obviously common and basic aspects of structure. After all, there is an innity of spaces.

Callender, C., I. Quinn, and D. Tymoczko (2006). Generalized chord spaces. http://music.princeton.edu/ dmitri/chordspaces.pdf. Cope, D. (1991). Computers and Musical Style. Number 6 in Computer Music and Digital Audio. Middleton, Wisconsin: A-R Editions. Cope, D. (1996). Experiments in Musical Style. Number 12 in Computer Music and Digital Audio. Middleton, Wisconsin: A-R Editions. Cope, D. (2000). The Algorithmic Composer. Number 16 in Computer Music and Digital Audio. Middleton, Wisconsin: A-R Editions. Dodge, C. (April 1994). Any Resemblance is Purely Coincidental, Audio cd Viola Elegy. New Albion Records. Gogins, M. (Winter 1992). Fractal music with string rewriting grammars. News of Music 13, 146170. Hiller, L. and L. Isaacson (Eds.) (1959). Experimental Music: Composition with an Electronic Computer. New York, New York: McGrawHill. Holtzman, S. R. (1981). Using generative grammars for music composition. Computer Music Journal 5(1), 5164. McCormack, J. (1996). Grammar based music composition. In R. S. et al. (Ed.), From Local Interactions to Global Phenomena, Complex Systems 96, Amsterdam. ISO Press. Oliphaunt, T., P. Peterson, and E. J. at al. (2005). Scipy scientic tools for python. http://www.scipy.org. Prusinkiewicz, P. and A. Lindenmayer (1996 [1991]). The Algorithmic Beauty of Plants. New York: Spring-Verlag. Available online at http://algorithmicbotany.org/ papers. Tymoczko, D. (2005). The geometry of musical chords. http://music.princeton.edu/dmitri/ voiceleading.pdf. van Rossum, G. (2006). Python. http://www.python.org. Vercoe, B., J. ftch, et al. (2006). The canonical csound reference manual. http://www.csounds.com/manual/ Csound5.00 manual.pdf. Xenakis, I. (1995). Xenakis: Ais, Gendy3, Taurhiphanie, Thallein / Nee, Steiger, Audio cd Gendy3. Number 45086. Neuma.

References
Burns, K. H. (1993). The History and Development of Algorithms in Music Composition, 1957-1993. Ph. D. thesis, Ball State University.

You might also like