CAO Generation Accords
CAO Generation Accords
CAO Generation Accords
Musical Spaces
Introduction
The use of algorithms to generate scores is as old as computer music (Hiller and Isaacson 1959). Today there are many methods of algorithmic composition (Burns 1993). They can broadly be categorized as either grammatical, i.e. based on some sort 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). Some examples of mathematically-generated pieces are Viola Elegy (Dodge 1994) and Gendy 3 (Xenakis 1995). I nd that the mathematical algorithms appeal more to my sense of musical taste, yet I also nd them difcult to control with respect to harmony and counterpoint, whether in the traditional sense, or in the more general sense of having largescale pitch structure and being well-formed. I do hear productions from grammatical algorithms that are harmonically and contrapuntally quite well-formed; yet to my taste, they do not sound sufciently original. Consequently, I have long
Tymoczko and colleagues (Tymoczko 2005; Callender, Quinn, and Tymoczko 2006) have begun developing a geometric approach to music theory. The starting point is to represent chords 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. Music theorists distinguish various equivalence classes for chords. For each equivalence class (such as octave equivalence, permutational equivalence, inversional equivalence, transpositional equivalence), as well as for each combination of equivalence classes, there is a corresponding orbifold in chord space. The equivalence denes which points of the space are identied to form an orbifold (Callender, Quinn, and Tymoczko 2006). 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 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.
Of course, the orbifold most familiar to musicians is pitch under octave equivalence, or pitch-class set space, R/12Z, where the octave is dened as 12 semitones. For another example, equivalence under range R for n n voices denes the orbifold (R/RZ) . I call this ranged chord space. It has a top and bottom pitch for each voice, like a score. Voices that move past the top of the score re-appear at the bottom. Figure 1 shows ranged chord space for 3 voices. Augmented triads are white, major triads red, and minor triads blue, but this is hard to see in the printed grayscale. Because its opposing faces are identied, the cube in the gure can be considered a 3-dimensional torus.
Figure 2: Tonnetz for trichords and minor triads (blue, light gray as printed) surrounding the central column of 4 augmented triads (white) that denes the orthogonal 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. n As a generalization of the Tonnetz, (R/12Z) /Sn 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 surround the orbifolds axis of symmetry, but also lie near each other. Similarly, for tetrachords, commonly used seventh chords surround the orthogonal column of diminished seventh chords. I nd understanding the Tonnetz to be extremely helpful for understanding other musical geometries. For an in-depth derivation of these spaces and more on their relationships to other parts of music theory, see (Tymoczko 2005; Callender, Quinn, and Tymoczko 2006). My approach here is inspired by Tymoczkos work, although I derive other spaces in order to represent the specic operations that I require for score generation.
2.1
The Tonnetz
(Tymoczko 2005) has identied the orbifold that divides pitch-class set space for n voices by the symmetry group for n n voices: (R/12Z) /Sn . This could be called the completed Tonnetz. Its fundamental domains are n 1 dimensional simplexes. The points 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 2 shows this 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 voiceleadings. The classical Tonnetz of Oettingen, Euler, and Riemann is simply the six columns of major (red, dark gray as printed)
2.2
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. I do not directly use the completed Tonnetz as a space for compositional algorithms, although it deserves further investigation for that purpose. My reason is that in the Tonnetz, whereas a primitive operation such as a translation vector that
does not cross a face of the orbifold has of course always the same orientation, if the same translation does cross a face it can change orientation as it is reected from a symmetry hyperplane. I nd it simpler to use spaces in which there are no mirrors, so that (for example) adding a vector to a chord always moves it along the same orientation, whether or not the chord is near a face of the quotient space. I have found two spaces to be the most useful for representing the primitive operations executed by Lindenmayer systems: ranged chord space, which I use to nd voice-leading solutions (so it could also be called voice-leading space), and normal chord space (dened below), which I use to implement chord progressions (so it could also be called chord progression space). 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. However, throughout the present work, pitch will always be represented in the lower subspace, and it is this subspace that is be meant when referring to chord space even if additional dimensions are in fact used to represent music. 2.2.1 Voice-Leading in Ranged Chord Space
3. Compare the voice-leading from each chord in the lattice to the source chord, rst by smoothness, then by parsimony (it is easy to add the option of excluding parallel fths). My current implementation uses a brute force search to compare voice-leading sizes, but as long as this need not be done in real time, it is fast enough. 4. Return the target chord with the closest voice-leading. Of course, with its chord-by-chord solutions, this algorithm does not perform backtracking to obtain voice-leadings that are optimal across a span of chords as do such rule-based counterpoint generators as (Schottstaedt 1984) or some of its descendants. But it would be easy to add memory to nd voice-leadings that are optimal across a span of chords. 2.2.2 Chord Progression in Normal Chord Space
Just as ranged chord space is a space in which applying a given voice-leading translation to any chord always produces the same pitch-class set, it is valuable to have a space in which applying a given chord-progression translation to any chord always produces the same pitch-class set. I call such a space normal chord space (not to be confused with normal order for chords!). This space can be formed by dividing the fundamental domains of the completed Tonnetz into symmetrical kites and stacking them on top of each other, as shown in Figure 3 for trichords.
Tymoczko denes a normlike total preorder for voiceleadings within the completed Tonnetz, rst by smoothness (distance between chords, using either the taxicab norm or the Euclidean norm), and then by parsimony (fewer or shorter movements of voices). Every known measure of voice-leading size creates a normlike total preorder (Tymoczko 2005), but Tymoczkos measure has the advantage of being very simple. I have used this normlike ordering to implement a simple algorithm for nding the closest voice-leading in ranged chord space from a source chord to a target pitch-class set. Such algorithms can be very useful in score generators. Keep in mind that each voice of the source chord could be in any octave of the spaces range. Because both the Tonnetz and ranged chord space inherit their metric from the same parent, Euclidean space, it follows that the normlike total preorder for voice-leadings in the Tonnetz also exists in ranged chord space. 1. Store the source chord and target pitch-class set. 2. Generate the lattice of all chords within ranged chord space that match the target pitch-class set, by iterating octavewise through all points in the space and storing the matching chords.
Figure 3: Normal chord space for trichords Both in the Tonnetz for trichords and in normal chord space, a chord transposition is simply a translation along the orthogonal axis of the quotient space. To illustrate reection from the orbifold mirrors, 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 reection) 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 third column (second reection) 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 pitchclasses, take these coordinates modulo 12): {-3, {-2, {-1, { 0, {-3, {-2, {-1, { 0, {-4, {-3, {-2, {-1, 1, 2, 3, 4, 0, 1, 2, 3, 1, 2, 3, 4, 4} 5} 6} 7} 5} 6} 7} 8} 5} 6} 7} 8}
As an example of such operations performed in different spaces, 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 chord that provides the closest voice-leading from the source chord to that 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 with a modulus that depends on the range of the resulting chord. Perform the translation that produces the desired progression. For example, the VI progression is produced by moving 5 semitones orthogonally up the colum of major triads in normal chord space, e.g. A to D is
In normal chord space, on the other hand, the chord moves step by step up the column of 12 major triads and then is shifted down an octave to begin again at the bottom of the same column, so the sequence of triads is: { 0, { 1, { 2, { 3, { 4, { 5, { 6, { 7, { 8, { 9, {10, {11, 2.2.3 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7} 8} 9} 10} 11} 12} 13} 14} 16} 17} 18} 19}
(9, 13, 16) + (5, 5, 5) = (14, 18, 21) 14 / 12 (12, 12, 12) = (2, 6, 9). In other words, if the rst voice of the resulting chord goes up (or down) out of its original octave, the whole chord is shifted down (or up) back into the original octave. For another example, the iiV progression is produced by moving 5 semitones orthogonally up the column of minor triads, then moving 1 semitone up in the 2nd voice to change the chord to a major triad, so the translation vector is (5, 6, 5). 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, using the voice-leading algorithm described above. 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.
An Example of Use
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. This enables composers to easily 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.
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.
(P commands), or chord progression space. Chords are created with the C commands. The Ca command creates a chord at the current position of the turtle in ranged chord space. The Cv command creates the chord equivalent to the target pitch-class set that is closest to the current position of the turtle according to Tymoczkos measure, using the voice-leading algorithm described above. Because each operation is dened on one or another quotient of chord space, all operations can actually be performed on points in chord space alone, using ordinary matrix arithmetic. The actual quotient space is dened by the specic modulus or other action that identies points in the space. 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
3.1
OL Lindenmayer Systems
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 4).
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, Jones, et 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).
Figure 4: Progression A sequence of these progressions can be created using a simple Lindenmayer system with one substitution rule (Table 3, Figure 5). Note the smooth voice-leading. Note also how the voices spread out because the voice-leading algorithm is concerned only with smoothness and parsimony, and not at all with range. This of course could be changed.
3.2
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 chord space. Sometimes the turtle is moving voicewise in ranged chord space (V commands), or voice-leading space, and sometimes it is moving chordwise in normal chord space
Figure 5: Sequence Table 4 and Figure 6 show how the V commands can move
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 , .., vn1 . 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 voice-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
voices one at a time to produce arbitrary counterpoint. In the 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.
5
5.1
Discussion
Limitations
This approach does know something about voice-leading; but nothing about counterpoint proper, imitative procedures, Iterations Axiom Replace B 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
tonal key, or serial procedures. These musical spaces always represent a xed number of voices, though dropping voices can be simulated by doubling or silencing some (Figure 6). The voice-leading algorithm is not exible, so the target chord stays close to the source chord in range, yet may wander up and down the score, or gradually widen or narrow in range. In other words, exercising basic movements within musical spaces does not model the ne points of musical hearing or of any musical style.
5.2
Strengths
Iterations Axiom
Replace A Replace B
Replace D Replace E
Replace F
3 C=CM7 V=4,0 V=5,1 V=6,2 V=7,3 A Cv Cv [ V=4,4 V=5,5 V=6,6 V=7,7 B Cv Cv B 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 [ V=4,4 V=5,5 V=6,6 V=7,7 Td2. Vs3,12 Ca Vs2,12 Ca Vs1,12, Ca Vs0,12 Vs1,12 Vs2,12 Vs3,12 Ca E Tm2.0 ] Cv Cv Pv1,2,1,2 Cv Pv5,5,5,6 Cv Pv2,2,3,2 Cv F Cv Table 5: Sample Piece
One reader of an earlier version of this paper noted that the simple operations described here could have been implemented in any number of ways why, therefore, do I feel that this geometric approach is better? I think it is better because representing chords as points makes it possible, without omitting information, to represent any piece of music as a function from time onto voice-leading space, or onto chord space. Ultimately this makes it not only possible, but easy, to manipulate all the information in a piece recursively (as with the Lindenmayer system), or even globally, using purely mathematical operations. Regarding the distinction between grammatical and mathematical algorithms for composition, the Lindenmayer system presented here is a hybrid. It is a generative grammar whose production is a geometry. In previous musical Lindenmayer systems, the productions have been geometries without musical interpretation. As a nal step in score generation, each geometry was mapped onto a range of pitches, times, voices, and so on; in other words, each dimension needed to be given a musical interpretation. In the Lindenmayer system presented here, the geometry has a built-in musical structure, which removes the need for most of these additional layers of musical interpretation. To my ear, this removes an audible element of arbitrariness from the music. This Lindenmayer system can focus, as it were, on counterpoint by using the V commands to directly control the movements of 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. To me, the most interesting musical feature of this system is how easily recursive patterns of movement in chord space can create top-down, hierarchical pitch structures of arbitrary depth.
5.3
Future Directions
It should be straightforward to modify the voice-leading algorithm to control range and spacing. It would of course be useful to have a concise way to represent changing numbers of voices. Although (as noted) these procedures do not model sophisticated hearing or particular styles, in the context of algorithmic composition the very simplicity of the underlying spaces and measures is a virtue, enabling the concepts to be adapted to a wide variety of compositional procedures. These could include chaotic dynamical systems, applying musical lters to images or scientic data, Xenakis sieves or other stochastic generators, and others. The use of geometry to model voice-leading and chords opens the composition of pitch structures up to all the resources of geometric algebra, and perhaps even topology and algebraic geometry. As far as I know, these branches of mathematics have not seen as much musical application as, say, group theory. The musical spaces discussed 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.
5.4
Acknowledgments
I thank Dmitri Tymoczko for his generous patience in discussion and for helping me with the mathematics. Any errors that remain here are of course my own. I also benetted from discussing earlier versions of these ideas with Drew Krause and the members of the New York Csound Users Group.
Dodge, C. (April 1994). Any Resemblance is Purely Coincidental, Audio cd Viola Elegy. Number NA043. 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. Stocker et al. (Eds.), From Local Interactions to Global Phenomena, Complex Systems 96, Amsterdam. ISO Press. Oliphaunt, T., P. Peterson, E. Jones, et 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. Schottstaedt, B. (1984, May). Automatic species counterpoint. Technical Report STAN-M-19, Center for Computer Research in Music and Acoustics, Stanford, California. Tymoczko, D. (2005). The geometry of musical chords. Unpublished, http://music.princeton.edu/dmitri. 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. Callender, C., I. Quinn, and D. Tymoczko (2006). Generalized chord spaces. Unpublished, http://music. princeton.edu/dmitri. 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.