8
_433 COMPUTING WITH CHORD SPACES Donya Quick, Paul Hudak Yale University Department of Computer Science New Haven, CT USA [email protected], [email protected] ABSTRACT The number of solutions involved in many algorithmic composition problems is too large to be tractable with- out simplification. Given this, it is critical that composi- tion algorithms be able to move through different levels of abstraction while maintaining a well-organized solu- tion space. In this paper we present the following con- tributions: (1) extended formalizations and proofs needed to implement the chord spaces defined by Tymoczko [11] and Callender et al. [2], (2) a generalized framework for moving between levels of abstraction using quotient spaces that can easily be integrated with existing algorithmic com- position algorithms, and (3) an application of both to voice- leading assignment. 1. INTRODUCTION A major problem in the area of algorithmic composition is the need for organized and easily traversable sets of solutions, also referred to as solution spaces, which are tractable in terms of both runtime and memory require- ments. Many music-theoretic ideas are also not formal- ized to the degree necessary to ensure correct implemen- tation of algorithms and accompanying data structures. In this paper we address both of these problems by pre- senting a general framework for organizing and traversing harmony-related solution spaces. Our work builds on that of of Tymoczko [11] and Callender et al. [2], adding an ad- ditional layer of formalization necessary to create a gen- eralized and extensible implementation. We then apply our framework to the task of voice-leading assignment, a common problem in music composition. Consider the following situation: given a sequence of chords intended for a soprano, tenor, and baritone, re- write the same chords for three tenors while factoring in additional constraints about each performer – perhaps one of the performers is a beginner, requiring smooth voice- leadings. This paper presents a set of algorithms and sup- porting proofs to automate algorithmic composition and arranging tasks such as above. Our approach utilizes two important concepts: chord spaces [2, 11] and musical pred- icates. A task such as outlined above will be referred to as a voice-leading assignment. Our goal is to construct a performable series of chords from incomplete information about those chords, such as the pitch classes involved in each. To assign a C-major triad to three voices, a spe- cific C, E, and G must be chosen. This involves choosing octaves for each pitch class and determining which pitch should be assigned to each voice. We use the term concrete chord to refer to chords with no room for additional interpretation and the term ab- stract chord when choices still exist. Voice-leading as- signment is the process of turning abstract chords into concrete chords. This is also representative of a larger category of tasks in composition: moving between differ- ent levels of abstraction in music. Particularly for large problems, the solution spaces must be well-structured and efficient to traverse. Our approach to voice-leading assignment uses a type of quotient space called a chord space [2, 11]. Chord spaces are a way to organize chords in musically mean- ingful ways and provide a convenient, intermediate level of organization between abstract and concrete chords. For example, one such chord space groups chords based on pitch class content, providing a useful level of abstraction for voice-leading assignment. We use this space to turn a sequence of abstract chords represented in terms of pitch classes into a sequence of concrete chords. When finished, each pitch class in each chord is assigned an octave and a particular voice. There are many other chord spaces that relate chords in different ways. These can also be used with our algo- rithm to perform variations on the voice-leading assign- ment task, allowing the algorithm a greater degree of con- trol over what musical features are generated. By simply changing the chord space, our voice-leading assignment algorithm can be generalized to make choices about pitch classes and octaves. Data-driven algorithms such as Markov chains have been used to learn voice-leading behavior from collections of examples [3, 12]. Markov chains suffer from state ex- plosion when addressing low-level features in music while still capturing structure. Variable-length Markov models [1] and probabilistic suffix trees [10] attempt to address this problem, but are still prone to the same problem with the large alphabets involved in musical problems. Chord spaces [2, 11] can help with this, since they allow gener- ative problems to be broken into multiple steps, each at a different level of abstraction. Chord spaces, however, present a number of repre-

Computing With Chord Spaces

  • Upload
    ipires

  • View
    2

  • Download
    0

Embed Size (px)

DESCRIPTION

Computing With Chord Spaces

Citation preview

  • _432 _433

    COMPUTINGWITH CHORD SPACES

    Donya Quick, Paul Hudak

    Yale UniversityDepartment of Computer Science

    New Haven, CT [email protected], [email protected]

    ABSTRACT

    The number of solutions involved in many algorithmiccomposition problems is too large to be tractable with-out simplification. Given this, it is critical that composi-tion algorithms be able to move through different levelsof abstraction while maintaining a well-organized solu-tion space. In this paper we present the following con-tributions: (1) extended formalizations and proofs neededto implement the chord spaces defined by Tymoczko [11]and Callender et al. [2], (2) a generalized framework formoving between levels of abstraction using quotient spacesthat can easily be integrated with existing algorithmic com-position algorithms, and (3) an application of both to voice-leading assignment.

    1. INTRODUCTION

    A major problem in the area of algorithmic compositionis the need for organized and easily traversable sets ofsolutions, also referred to as solution spaces, which aretractable in terms of both runtime and memory require-ments. Many music-theoretic ideas are also not formal-ized to the degree necessary to ensure correct implemen-tation of algorithms and accompanying data structures.In this paper we address both of these problems by pre-senting a general framework for organizing and traversingharmony-related solution spaces. Our work builds on thatof of Tymoczko [11] and Callender et al. [2], adding an ad-ditional layer of formalization necessary to create a gen-eralized and extensible implementation. We then applyour framework to the task of voice-leading assignment, acommon problem in music composition.

    Consider the following situation: given a sequence ofchords intended for a soprano, tenor, and baritone, re-write the same chords for three tenors while factoring inadditional constraints about each performer perhaps oneof the performers is a beginner, requiring smooth voice-leadings. This paper presents a set of algorithms and sup-porting proofs to automate algorithmic composition andarranging tasks such as above. Our approach utilizes twoimportant concepts: chord spaces [2, 11] andmusical pred-icates.

    A task such as outlined above will be referred to asa voice-leading assignment. Our goal is to construct aperformable series of chords from incomplete information

    about those chords, such as the pitch classes involved ineach. To assign a C-major triad to three voices, a spe-cific C, E, and G must be chosen. This involves choosingoctaves for each pitch class and determining which pitchshould be assigned to each voice.

    We use the term concrete chord to refer to chords withno room for additional interpretation and the term ab-stract chord when choices still exist. Voice-leading as-signment is the process of turning abstract chords intoconcrete chords. This is also representative of a largercategory of tasks in composition: moving between differ-ent levels of abstraction in music. Particularly for largeproblems, the solution spaces must be well-structured andefficient to traverse.

    Our approach to voice-leading assignment uses a typeof quotient space called a chord space [2, 11]. Chordspaces are a way to organize chords in musically mean-ingful ways and provide a convenient, intermediate levelof organization between abstract and concrete chords. Forexample, one such chord space groups chords based onpitch class content, providing a useful level of abstractionfor voice-leading assignment. We use this space to turn asequence of abstract chords represented in terms of pitchclasses into a sequence of concrete chords. When finished,each pitch class in each chord is assigned an octave and aparticular voice.

    There are many other chord spaces that relate chordsin different ways. These can also be used with our algo-rithm to perform variations on the voice-leading assign-ment task, allowing the algorithm a greater degree of con-trol over what musical features are generated. By simplychanging the chord space, our voice-leading assignmentalgorithm can be generalized to make choices about pitchclasses and octaves.

    Data-driven algorithms such as Markov chains havebeen used to learn voice-leading behavior from collectionsof examples [3, 12]. Markov chains suffer from state ex-plosion when addressing low-level features in music whilestill capturing structure. Variable-length Markov models[1] and probabilistic suffix trees [10] attempt to addressthis problem, but are still prone to the same problem withthe large alphabets involved in musical problems. Chordspaces [2, 11] can help with this, since they allow gener-ative problems to be broken into multiple steps, each at adifferent level of abstraction.

    Chord spaces, however, present a number of repre-

  • _434 _435

    sentational issues. Being a type of quotient space, chordspaces are specified with equivalence relations. Whencombining two equivalence relations to produce a new oneor when applying more than one equivalence relation toa set to produce a quotient space, it is not always easyto preserve properties like transitivity or to find an effi-cient representation for the relation or the quotient space.We present additional formalizations and algorithms toaddress these types of representational issues for chordspaces.

    Finally, algorithms that perform well at large-scalecompositional tasks, such as those presented in the workof Ebcioglu [6] and Cope [4, 5], tend to have application-specific aspects to the implementations that make gen-eralization and reuse difficult. In this paper, we aim toachieve a general result that has application to any al-gorithmic composition problem that requires moving be-tween multiple levels of abstraction to find a solution. Weshow one such application to voice-leading assignment.Our approach utilizes chord spaces to organize the solu-tion space and controls voice-leading behavior (the exactup/down movement in each voice from one chord to thenext) through the use of musical predicates, which caneasily be constructed to follow common music-theoreticprinciples, such as prohibiting voice crossing and parallelmotion.

    2. CHORD SPACES

    We represent chords as vectors of integers, where everyinteger represents a pitch. Middle C, (C,4), is the integer60. (C#,4) is 61, and so on. Vectors are written as v torefer to a single vector and x1,x2, ...,xn to show all of thevectors elements. A chord is represented as a vector ofintegers. The set of all possible chords of length n (havingn voices) is Zn. [a,b]n is the set of all vectors x1, ...,xnwhere a xi b. We write sequences of vectors using thenotation [v1, ..., vn]. The notation 1n denotes the vector oflength n whose elements are all 1.

    A quotient space formed by applying relation R toset S is denoted S/R. A chord space is a quotient spaceformed from Zn and an equivalence relation on chords(vectors). The quotient space formed from Zn and anequivalence relation R is referred to as R-space. Two ele-ments of the same equivalence class under R are said to beR-equivalent. The notation E(x,S/R) denotes xs equiva-lence class under S/R, namely {y S | yR x}.

    Relations that form musically-meaningful partitionsof Zn are useful for automated composition tasks. Oneway to construct musically-meaningful equivalence rela-tions is to exploit existing concepts in music theory, suchas the ideas of pitch class and transposition. Tymoczkoand Callender et al. introduce several such relations onchords, each based on some concept in music theory [11,2]. Each relation is defined over vectors in Rn, which usesthe same mapping of whole numbers to pitches but also al-lows for microtones (a pitch of 60.5 would be a microtonejust above middle C). All of the relations are applicable

    to our discrete pitch space, Zn, as well. We make use ofthree of these equivalence relations:

    Octave equivalence, O. Chords belong to the sameequivalence class if they have the same vectors ofpitch classes: v O v+ 12i,i Zn [2]. For exam-ple, 0,4,7 and 12,4,7 areO-equivalent; they areboth C-major triads where the voices have the pitchclasses C, E, and G respectively.

    Permutation equivalence, P. Chords with the samemultisets of pitches belong to the same equivalenceclass under this relation. P can be defined using thesymmetric group of order n, Sn (the set of all per-mutation functions for n elements):v P (v), Sn [2]. For example, 0,4,7 and4,0,7 are P-equivalent.

    Transposition equivalence, T . Chords with the sameintervallic content belong to the same equivalenceclass. For example, 0,4,7 and 1,5,8 are T -equivalent. The relation is defined in [2] asv T v+ c1n,c R, but we further constrain thedefinition by requiring c Z for the remainder ofthis paper to be consistent with our discrete inter-pretation of pitches.

    The O, P, and T relations can be used individuallyor combined to produce additional equivalence relations.Two equivalence relations, R1 and R2, can be combinedto make a new equivalence relation using the join opera-tion, R1 R2 [8]. We will use the notation R+ to denotethe transitive closure of relation R. For two equivalencerelations, R1 and R2, where R1 R2 is the composition ofthe two relations:

    R1R2 = (R1 R2R2 R1)+ (1)

    The join operation is commutative, such thatR1 R2 = R2 R1. For simplicity, we will abbreviateR1R2 as simply R1R2. For two points x,y S,

    xR1R2 yz S,xR1 zR2 y (2)The join operation can be used to combine the OPT

    relations to produce four other equivalence relations de-scribed in [2, 11]: OP, OT , PT , and OPT :

    Octave and Transposition equivalence, OT .vOT v+12i+ c1n,i Zn,c Z (or c R for mi-crotonal systems). Chords in the same equivalenceclass have the same intervallic structure when rep-resented as vectors of pitch classes. For example,0,4,7 OT 13,5,8.

    Octave and Permutation equivalence, OP.v OP (v+ 12i),i Zn, Sn. Chords in thesame equivalence class have the same multisets ofpitch classes. For n = 3 voices, OP-space containsan equivalence class for all C-major triads, anotherfor all C-minor triads, and so on.

    Permutation and Transposition equivalence, PT .v PT (v+ c1n), Sn,c Z (or c R for mi-crotonal systems). Chords in the same equivalenceclass share the same intervallic structure of theirmultisets of pitches. For example:

    0,4,7 PT 5,1,8. Octave, Permutation, and Transposition equivalence,

    OPT . v OP (v+ 12i+ c1n),i Zn, Sn,c Z. Chords in the same equivalence class have thesame intervallic structure of their multisets of pitchclasses, capturing the notion of chord quality. Forexample, 0,4,7 OPT 0,3,8, where 0,4,7 is aC-major triad and 0,3,8 is an A-flat-major triad.This can be seen as follows:

    0,4,7 O 12,4,7 T 8,0,3 P 0,3,8

    2.1. Normalizations and Representative Subsets

    To construct and use a chord space under relation R, itmust be possible to test the R-equivalence of two chords.Points a and b are related under R if (a,b) R. However,if R is large (possibly infinite), such a search can be com-putationally intractible. Indeed, because Zn is infinite, allof the spaces formed by O, P, and T are also infinite.

    To address this problem, we take the following com-putational approach: for a set S, relation R, and quotientspace S/R, rather than enumerate the entire equivalenceclass of an element s S, we compute a representativepoint of that equivalence class. We refer to the set of allrepresentative points as the representative subset of S/R,which we denote by SR. If a function f : S SR has theproperty that every point in S is R-equivalent to exactlyone point in SR, it is called a normalization. More for-mally:

    Definition 1. SR S is a representative subset for S/R iffx S, there is only one y SR such that xR y.Definition 2. f is a normalization for the quotient spaceS/R whenever x,y S, f (x) = f (y) xR y

    For example, a normalization forO, denoted as normO,is straightforward:

    Algorithm 1.

    normO(x1, ...,xn) = x1 mod 12, ...,xn mod 12)If normO(x) = normO(y)we know that x and y belong

    to the same O-equivalence class.A normalization for P is similarly straightforward:

    Algorithm 2. normP(v) = sort(v)

    where sort : Zn Zn arranges a vectors elements inascending order. Thus if normP(x) = normP(y) we knowthat x and y belong to the same P-equivalence class.

    Proofs that both normO and normP are normalizationsfor their respective spaces are trivial and are omitted.

    Consider now OP-equivalence. A suitable normaliza-tion algorithm can be defined as:

    Algorithm 3. normOP(v) = normP(normO(v))

    In other words, normOP is the composition of the nor-malizations for P-equivalence and O-equivalence; i.e.normOP = normP normO. Also note that normOP re-turns chords falling within:

    SOP = {x1,x2, ...,xn [0,11]n,x1 x2 ... xn}For example, the chords: 0,16,7 and 12,7,4 are

    OP-equivalent because:

    normOP(0,16,7) = 0,4,7= normOP(12,7,4)In this case, the OP-equivalence class is that of C-majortriads: chords containing the pitch classes C, E, and G.

    That normOP can be defined as the composition ofthe normalizations for O and P is a special case. Givennormalizations f1 and f2 for relations R1 and R2 respec-tively, there is no guarantee that f1 and f2 can be simplycomposed to create a proper normalization for the newequivalence relation.

    Indeed, even the order of composition is important. Ifwe were to reverse the order of composition in the defini-tion of normOP, i.e. apply the normalization for P-spacefirst (sort) and then the normalization forO-space (take allpitches mod12), points that should be OP-equivalent aremapped differently, thereby breaking one of the require-ments for a representative subset (that all OP-equivalentpoints must map to the same representative point). For ex-ample, recall from above that 0,16,7 and 12,7,4 areOP-equivalent. But if we reverse the order of composi-tion, lets call it normOP, we have normOP(0,16,7) =0,7,4, whereas normOP(12,7,4) = 4,7,0.

    Equivalence relations can have more than one normal-ization, and different normalizations may be needed un-der different circumstances. This is easily seen for T -equivalence.

    Theorem 1. Let F = { f1, ..., fn} be the set of functionsfi = (x1, ...,xn) = x1 xi, ...,xn xi. An algorithm A :Zn Zn is a normalization for Zn/T iff, for all x Zn,it applies the same fi to all members of xs equivalenceclass, E(x,Zn/T ).

    Proof. Recall that x t y c Z,x =y+ c1n. Twochords are T -equivalent if they have the same intervallicstructure.

    Letx= x1, ...,xn,y= y1, ...,yn. Letx= x1xi, ...,xnxi,y= y1yi, ...,ynyi

    for some i Z. If x and y have the same intervallic structure (the

    definition of T -equivalence), then x and y will beequal and the ith element of both x and y will be0. We therefore have that c= xi yi andx T x =y T y.

    If x and y are not T -equivalent, then the intervallicstructures are different and x =y.

  • _434 _435

    sentational issues. Being a type of quotient space, chordspaces are specified with equivalence relations. Whencombining two equivalence relations to produce a new oneor when applying more than one equivalence relation toa set to produce a quotient space, it is not always easyto preserve properties like transitivity or to find an effi-cient representation for the relation or the quotient space.We present additional formalizations and algorithms toaddress these types of representational issues for chordspaces.

    Finally, algorithms that perform well at large-scalecompositional tasks, such as those presented in the workof Ebcioglu [6] and Cope [4, 5], tend to have application-specific aspects to the implementations that make gen-eralization and reuse difficult. In this paper, we aim toachieve a general result that has application to any al-gorithmic composition problem that requires moving be-tween multiple levels of abstraction to find a solution. Weshow one such application to voice-leading assignment.Our approach utilizes chord spaces to organize the solu-tion space and controls voice-leading behavior (the exactup/down movement in each voice from one chord to thenext) through the use of musical predicates, which caneasily be constructed to follow common music-theoreticprinciples, such as prohibiting voice crossing and parallelmotion.

    2. CHORD SPACES

    We represent chords as vectors of integers, where everyinteger represents a pitch. Middle C, (C,4), is the integer60. (C#,4) is 61, and so on. Vectors are written as v torefer to a single vector and x1,x2, ...,xn to show all of thevectors elements. A chord is represented as a vector ofintegers. The set of all possible chords of length n (havingn voices) is Zn. [a,b]n is the set of all vectors x1, ...,xnwhere a xi b. We write sequences of vectors using thenotation [v1, ..., vn]. The notation 1n denotes the vector oflength n whose elements are all 1.

    A quotient space formed by applying relation R toset S is denoted S/R. A chord space is a quotient spaceformed from Zn and an equivalence relation on chords(vectors). The quotient space formed from Zn and anequivalence relation R is referred to as R-space. Two ele-ments of the same equivalence class under R are said to beR-equivalent. The notation E(x,S/R) denotes xs equiva-lence class under S/R, namely {y S | yR x}.

    Relations that form musically-meaningful partitionsof Zn are useful for automated composition tasks. Oneway to construct musically-meaningful equivalence rela-tions is to exploit existing concepts in music theory, suchas the ideas of pitch class and transposition. Tymoczkoand Callender et al. introduce several such relations onchords, each based on some concept in music theory [11,2]. Each relation is defined over vectors in Rn, which usesthe same mapping of whole numbers to pitches but also al-lows for microtones (a pitch of 60.5 would be a microtonejust above middle C). All of the relations are applicable

    to our discrete pitch space, Zn, as well. We make use ofthree of these equivalence relations:

    Octave equivalence, O. Chords belong to the sameequivalence class if they have the same vectors ofpitch classes: v O v+ 12i,i Zn [2]. For exam-ple, 0,4,7 and 12,4,7 areO-equivalent; they areboth C-major triads where the voices have the pitchclasses C, E, and G respectively.

    Permutation equivalence, P. Chords with the samemultisets of pitches belong to the same equivalenceclass under this relation. P can be defined using thesymmetric group of order n, Sn (the set of all per-mutation functions for n elements):v P (v), Sn [2]. For example, 0,4,7 and4,0,7 are P-equivalent.

    Transposition equivalence, T . Chords with the sameintervallic content belong to the same equivalenceclass. For example, 0,4,7 and 1,5,8 are T -equivalent. The relation is defined in [2] asv T v+ c1n,c R, but we further constrain thedefinition by requiring c Z for the remainder ofthis paper to be consistent with our discrete inter-pretation of pitches.

    The O, P, and T relations can be used individuallyor combined to produce additional equivalence relations.Two equivalence relations, R1 and R2, can be combinedto make a new equivalence relation using the join opera-tion, R1 R2 [8]. We will use the notation R+ to denotethe transitive closure of relation R. For two equivalencerelations, R1 and R2, where R1 R2 is the composition ofthe two relations:

    R1R2 = (R1 R2R2 R1)+ (1)

    The join operation is commutative, such thatR1 R2 = R2 R1. For simplicity, we will abbreviateR1R2 as simply R1R2. For two points x,y S,

    xR1R2 yz S,xR1 zR2 y (2)The join operation can be used to combine the OPT

    relations to produce four other equivalence relations de-scribed in [2, 11]: OP, OT , PT , and OPT :

    Octave and Transposition equivalence, OT .vOT v+12i+ c1n,i Zn,c Z (or c R for mi-crotonal systems). Chords in the same equivalenceclass have the same intervallic structure when rep-resented as vectors of pitch classes. For example,0,4,7 OT 13,5,8.

    Octave and Permutation equivalence, OP.v OP (v+ 12i),i Zn, Sn. Chords in thesame equivalence class have the same multisets ofpitch classes. For n = 3 voices, OP-space containsan equivalence class for all C-major triads, anotherfor all C-minor triads, and so on.

    Permutation and Transposition equivalence, PT .v PT (v+ c1n), Sn,c Z (or c R for mi-crotonal systems). Chords in the same equivalenceclass share the same intervallic structure of theirmultisets of pitches. For example:

    0,4,7 PT 5,1,8. Octave, Permutation, and Transposition equivalence,

    OPT . v OP (v+ 12i+ c1n),i Zn, Sn,c Z. Chords in the same equivalence class have thesame intervallic structure of their multisets of pitchclasses, capturing the notion of chord quality. Forexample, 0,4,7 OPT 0,3,8, where 0,4,7 is aC-major triad and 0,3,8 is an A-flat-major triad.This can be seen as follows:

    0,4,7 O 12,4,7 T 8,0,3 P 0,3,8

    2.1. Normalizations and Representative Subsets

    To construct and use a chord space under relation R, itmust be possible to test the R-equivalence of two chords.Points a and b are related under R if (a,b) R. However,if R is large (possibly infinite), such a search can be com-putationally intractible. Indeed, because Zn is infinite, allof the spaces formed by O, P, and T are also infinite.

    To address this problem, we take the following com-putational approach: for a set S, relation R, and quotientspace S/R, rather than enumerate the entire equivalenceclass of an element s S, we compute a representativepoint of that equivalence class. We refer to the set of allrepresentative points as the representative subset of S/R,which we denote by SR. If a function f : S SR has theproperty that every point in S is R-equivalent to exactlyone point in SR, it is called a normalization. More for-mally:

    Definition 1. SR S is a representative subset for S/R iffx S, there is only one y SR such that xR y.Definition 2. f is a normalization for the quotient spaceS/R whenever x,y S, f (x) = f (y) xR y

    For example, a normalization forO, denoted as normO,is straightforward:

    Algorithm 1.

    normO(x1, ...,xn) = x1 mod 12, ...,xn mod 12)If normO(x) = normO(y)we know that x and y belong

    to the same O-equivalence class.A normalization for P is similarly straightforward:

    Algorithm 2. normP(v) = sort(v)

    where sort : Zn Zn arranges a vectors elements inascending order. Thus if normP(x) = normP(y) we knowthat x and y belong to the same P-equivalence class.

    Proofs that both normO and normP are normalizationsfor their respective spaces are trivial and are omitted.

    Consider now OP-equivalence. A suitable normaliza-tion algorithm can be defined as:

    Algorithm 3. normOP(v) = normP(normO(v))

    In other words, normOP is the composition of the nor-malizations for P-equivalence and O-equivalence; i.e.normOP = normP normO. Also note that normOP re-turns chords falling within:

    SOP = {x1,x2, ...,xn [0,11]n,x1 x2 ... xn}For example, the chords: 0,16,7 and 12,7,4 are

    OP-equivalent because:

    normOP(0,16,7) = 0,4,7= normOP(12,7,4)In this case, the OP-equivalence class is that of C-majortriads: chords containing the pitch classes C, E, and G.

    That normOP can be defined as the composition ofthe normalizations for O and P is a special case. Givennormalizations f1 and f2 for relations R1 and R2 respec-tively, there is no guarantee that f1 and f2 can be simplycomposed to create a proper normalization for the newequivalence relation.

    Indeed, even the order of composition is important. Ifwe were to reverse the order of composition in the defini-tion of normOP, i.e. apply the normalization for P-spacefirst (sort) and then the normalization forO-space (take allpitches mod12), points that should be OP-equivalent aremapped differently, thereby breaking one of the require-ments for a representative subset (that all OP-equivalentpoints must map to the same representative point). For ex-ample, recall from above that 0,16,7 and 12,7,4 areOP-equivalent. But if we reverse the order of composi-tion, lets call it normOP, we have normOP(0,16,7) =0,7,4, whereas normOP(12,7,4) = 4,7,0.

    Equivalence relations can have more than one normal-ization, and different normalizations may be needed un-der different circumstances. This is easily seen for T -equivalence.

    Theorem 1. Let F = { f1, ..., fn} be the set of functionsfi = (x1, ...,xn) = x1 xi, ...,xn xi. An algorithm A :Zn Zn is a normalization for Zn/T iff, for all x Zn,it applies the same fi to all members of xs equivalenceclass, E(x,Zn/T ).

    Proof. Recall that x t y c Z,x =y+ c1n. Twochords are T -equivalent if they have the same intervallicstructure.

    Letx= x1, ...,xn,y= y1, ...,yn. Letx= x1xi, ...,xnxi,y= y1yi, ...,ynyi

    for some i Z. If x and y have the same intervallic structure (the

    definition of T -equivalence), then x and y will beequal and the ith element of both x and y will be0. We therefore have that c= xi yi andx T x =y T y.

    If x and y are not T -equivalent, then the intervallicstructures are different and x =y.

  • _436 _437

    Therefore, A(x) = A(y)xT y.Corollary 1. The following function:

    normT (x1, ...,xn) = x1 x1, ...,xn x1 (3)which subtracts the first element of a vector from all otherelements, is a normalization for Zn/T .

    The order-of-composition problem also exists for OT -equivalence. The normalizations for O and T can be com-posed in one order to produce a proper normalization forOT , but not the other. This can be summarized as a moregeneralized theorem:

    Theorem 2. If relations R1 and R2 have normalizations f1and f2, respectively, with ranges S1 and S2, respectively,such that S1 S2 = /0, then if f3 = f1 f2 has the rangeS3 = S1S2, then f3 is a normalization for R1R2.Proof. From definition 1, S1 and S2 are representative sub-sets for R1 and R2 respectively. Every point in a represen-tative subset for some relation R belongs to a different R-equivalence class. When applying additional equivalencerelations to a set, the number of equivalence classes cannever increase. If an element is in S1S2, it must be R2-equivalent to an element in S1 S2. Similarly, elementsin S2 S1 must be R1-equivalent to elements in S1 S2.S3 is therefore the only set of points which are not R1R2-equivalent to each other. Therefore, every point outsideof S1 S2 will map to only one point in S3, meeting therequirements for f3 to be a normalization and S3 to be arepresentative subset for R1R2.

    Corollary 2. The function normOT = normO normT isa normalization for Zn/OT.

    Proof. Recall thatxOT yx=y+12i+ c1. normT s range is ST1 = {0,x2, ...,xn Zn}. normOs range is SO = [0,11]n. normOT s range is SOT = {0,x2, ...,xn [0,11]n}.

    SOT = SOST1, therefore normOT is a normalization forOT .

    Corollary 3. Algorithm 3, normOP, is a normalizationfor OP-space.

    Proof.

    normOs range is [0,11]n. normPs range is SP = {x Zn |x= sort(x)} normOPs range is SOP = {x [0,11]n |x= sort(x)}

    SOP = [0,11]nSP, therefore normOP is a normalizationfor OP.

    A normalization also exists for PT :

    Algorithm 4. normPT = normT normP

    The proof that this is a normalization also follows di-rectly from theorem 2.

    Finding a normalization is not always the most effi-cient way to check for equivalence class membership. Anexample of this is OPT -equivalence. While a convenientrepresentative subset of OPT -space exists, the set of allvectors in [0,11]n whose first element is zero and whoseintervals between elements are sorted in ascending order[2, 11], it is not easy to normalize chords into this subsetof Zn/OPT . The reason for this is illustrated by the points0,2,7 and 0,5,7, which are related by:

    0,5,7 O 12,5,7 P 5,7,12 T 0,2,7The point 0,5,7 should, therefore, be normalized to0,2,7 under the conventions of our representative sub-set. However, we cannot use any of the normalizationsdiscussed so far to accomplish this. 0,5,7will be mappedto itself with normP, normO, and normT . The same thinghappens with 0,2,7 as well. Therefore, we have twochoices: create one or more new normalizations, or useanother algorithm to test whether two chords are OPT -equivalent.

    We have chosen to use another algorithm that, althoughmakes use of the O, P, and T normalizations, does notdefine a normalization for the OPT relation itself. Thisalgorithm returns true if and only if two chords are OPT -equivalent.

    Algorithm 5. optEq(x,y) =

    1. Let x = normOP(x), y = normOP(y).

    2. Let Sy = {normPT (y+12i) |i [0,1]ni = 1n}.3. If x Sy then return true, otherwise return false.Two chords are OPT -equivalent if some stacking of

    their pitch classes have the same multiset of intervals. Syincludes all possible sorted intervallic structures ofys pitchclasses. We have that x [0,11]n, x is sorted, and Sy in-cludes all sorted, OPT -equivalent vectors to y within therange [0,11]n. Therefore x Sy xOPT y.

    3. GENERATING CHORD PROGRESSIONS

    Finding a normalization for a chord space is importantbecause it is one way to determine which chords belongto the same equivalence class. Many progressions willshare the same pattern of representative points when theirchords are normalized, so the process of rewriting har-mony for n voices using chord spaces can be modeled asa three-step process:

    1. Normalizing the chords in the original progressionto find a path through the representative subset ofZn/R.

    2. Generating all solutions that share the same normal-ized path.

    3. Choosing a solution with the desired characteristics.

    In the case of our example for three tenors, R would beOP and the desired characteristics would include specificranges for each voice.

    A sequence of equivalence classes represents manypossible concrete progressions, each with a unique paththrough Zn. In OP-space, choosing the specific shape ofthe path through a series of equivalence classes is anal-ogous to choosing a voice-leading behavior. For a chordspace, Zn/R and a sequence of concrete chords,X = [x0, ...,xm],xi Zn, the set of chord progressions shar-ing the same sequence of equivalence classes as X is:

    {[y0, ...,ym] |yi E(xi,Zn/R)} (4)

    We can further constrain this to some subset of Zn, limit-ing the range of each voice based on instrumental or per-former constraints.

    {[y0, ...,ym] |yi E(xi,S/R), S Zn} (5)

    Finally, we want solutions that exhibit desirable behav-ior, such as those having certain voice-leading characteris-tics (e.g. smooth voice-leadings, no voice crossings, etc.).Given a musical predicate, H, that defines what desirablebehavior is for a chord progression, we can further narrowthe set of candidate solutions:

    {[y1, ..., ym] |yi E(xi,S/R), S ZnH([y1, ..., ym])}(6)

    3.1. Musical Predicates

    We define two types of musical predicates: pairwise andprogression predicates. Pairwise predicates apply to pairsof chords, and progression predicates apply to a sequence,or progression of m chords.

    First we define a pairwise predicate that rejects caseswhere voice crossing occurs. When voices cross, a per-mutation that sorts one chords voices will not correctlysort the other chords voices.

    hnoCross(x,y) =

    Sn |(x) = sort(x)(y) = sort(y)(7)

    Similarly, we define pairwise predicates for avoidingparallel motion (when two voices move in the same direc-tion by the same amount) and for limiting the maximummovement of each voice.

    hnoPar(x1, ...,xn,y1, ...,yn) =i, j [1,n], i = j,yi xi = y j x j

    (8)

    hmaxDist(t,x1, ...,xn,y1, ...,yn) =xi,yi, | yi xi | t

    (9)

    Finally, given a pairwise predicate, hpair, a progres-sion predicate can be created from it.

    hprog(hpair, [x1, ..., xm]) =m1i=1

    hpair(xi, xi+1) (10)

    3.2. Algorithms for Applying Predicates

    Finding a chord progression satisfying certain predicatesis analogous to the satisfiability problem in computer sci-ence, which is NP-complete for arbitrary formulas onBoolean variables [7]. Because of this, there is a tractabil-ity issue involved in finding candidate solutions that sat-isfy one or more potentially arbitrary predicates. If thereare k possible choices for each of m chords in a progres-sion, there are km total possibilities. For a given quotientspace S/R and predicate H we clearly need a more effi-cient method for finding solutions than generating all R-equivalent solutions, storing them, and then looking forcases satisfyingH. An algorithm generatingH-acceptablesolutions must performmore aggressive pruning of the so-lution space.

    One way to prune the solution space is through theuse of predicates that operate on sub-progressions, suchas pairwise predicates. An algorithm can apply the pred-icates while generating partial solutions. We present onesuch algorithm below for pairwise predicates. While thisgeneral strategy does not change the complexity class ofthe problem, it avoids computing and storing unnecessaryprogressions.

    Algorithm 6. pairProg(R,S,hpair, [x1, ..., xm]) =

    1. If m = 1, return E(x1,S/R) = {z |z SzRx},otherwise continue.

    2. Let Y = pairProg(R,S,hpair, [x2, ..., xm])

    3. Return {[y1, y2, ...,ym] |y1 E(x1,S/R),[y2, ...,ym] Y, hpair(y1, y2)}.

    Even when solutions are filtered using predicates, thework involved in traversing the entire set of solutions tolocate desirable ones and even the number of desirablesolutions can be intractable in situations involving manychords, many voices, and/or large ranges for the voices.Fortunately, in music, rules are not always strict, and soit may be sufficient to find a solution that mostly satis-fies a set of predicates, even if some parts of the solutionviolate the predicates. We present an alternative, greedyalgorithm for generating chord progressions that, whilenot guaranteed to find a solution satisfying a progressionpredicate, will attempt to satisfy a pairwise predicate whenchoosing each chord.

    Algorithm 7. Let xi be the chord for which we wish tofind a new R-equivalent member of S Zn,yi. Letyi1 bethe previously chosen chord, choose(S) be a function tostochastically select an element from a set, andf (xi,yi1,E(xi,S/R)) be a fall-back method for choosingyi.

    greedyChord(xi,yi1,S Zn,R,Hpair, f ) =1. Let SH = {y E(xi,S/R) |Hpair(yi1,y)}2. If SH = /0 then return yi = f (xi,yi1,E(xi,S/R)).

    Otherwise, returnyi = choose(SH).

  • _436 _437

    Therefore, A(x) = A(y)xT y.Corollary 1. The following function:

    normT (x1, ...,xn) = x1 x1, ...,xn x1 (3)which subtracts the first element of a vector from all otherelements, is a normalization for Zn/T .

    The order-of-composition problem also exists for OT -equivalence. The normalizations for O and T can be com-posed in one order to produce a proper normalization forOT , but not the other. This can be summarized as a moregeneralized theorem:

    Theorem 2. If relations R1 and R2 have normalizations f1and f2, respectively, with ranges S1 and S2, respectively,such that S1 S2 = /0, then if f3 = f1 f2 has the rangeS3 = S1S2, then f3 is a normalization for R1R2.Proof. From definition 1, S1 and S2 are representative sub-sets for R1 and R2 respectively. Every point in a represen-tative subset for some relation R belongs to a different R-equivalence class. When applying additional equivalencerelations to a set, the number of equivalence classes cannever increase. If an element is in S1S2, it must be R2-equivalent to an element in S1 S2. Similarly, elementsin S2 S1 must be R1-equivalent to elements in S1 S2.S3 is therefore the only set of points which are not R1R2-equivalent to each other. Therefore, every point outsideof S1 S2 will map to only one point in S3, meeting therequirements for f3 to be a normalization and S3 to be arepresentative subset for R1R2.

    Corollary 2. The function normOT = normO normT isa normalization for Zn/OT.

    Proof. Recall thatxOT yx=y+12i+ c1. normT s range is ST1 = {0,x2, ...,xn Zn}. normOs range is SO = [0,11]n. normOT s range is SOT = {0,x2, ...,xn [0,11]n}.

    SOT = SOST1, therefore normOT is a normalization forOT .

    Corollary 3. Algorithm 3, normOP, is a normalizationfor OP-space.

    Proof.

    normOs range is [0,11]n. normPs range is SP = {x Zn |x= sort(x)} normOPs range is SOP = {x [0,11]n |x= sort(x)}

    SOP = [0,11]nSP, therefore normOP is a normalizationfor OP.

    A normalization also exists for PT :

    Algorithm 4. normPT = normT normP

    The proof that this is a normalization also follows di-rectly from theorem 2.

    Finding a normalization is not always the most effi-cient way to check for equivalence class membership. Anexample of this is OPT -equivalence. While a convenientrepresentative subset of OPT -space exists, the set of allvectors in [0,11]n whose first element is zero and whoseintervals between elements are sorted in ascending order[2, 11], it is not easy to normalize chords into this subsetof Zn/OPT . The reason for this is illustrated by the points0,2,7 and 0,5,7, which are related by:

    0,5,7 O 12,5,7 P 5,7,12 T 0,2,7The point 0,5,7 should, therefore, be normalized to0,2,7 under the conventions of our representative sub-set. However, we cannot use any of the normalizationsdiscussed so far to accomplish this. 0,5,7will be mappedto itself with normP, normO, and normT . The same thinghappens with 0,2,7 as well. Therefore, we have twochoices: create one or more new normalizations, or useanother algorithm to test whether two chords are OPT -equivalent.

    We have chosen to use another algorithm that, althoughmakes use of the O, P, and T normalizations, does notdefine a normalization for the OPT relation itself. Thisalgorithm returns true if and only if two chords are OPT -equivalent.

    Algorithm 5. optEq(x,y) =

    1. Let x = normOP(x), y = normOP(y).

    2. Let Sy = {normPT (y+12i) |i [0,1]ni = 1n}.3. If x Sy then return true, otherwise return false.Two chords are OPT -equivalent if some stacking of

    their pitch classes have the same multiset of intervals. Syincludes all possible sorted intervallic structures ofys pitchclasses. We have that x [0,11]n, x is sorted, and Sy in-cludes all sorted, OPT -equivalent vectors to y within therange [0,11]n. Therefore x Sy xOPT y.

    3. GENERATING CHORD PROGRESSIONS

    Finding a normalization for a chord space is importantbecause it is one way to determine which chords belongto the same equivalence class. Many progressions willshare the same pattern of representative points when theirchords are normalized, so the process of rewriting har-mony for n voices using chord spaces can be modeled asa three-step process:

    1. Normalizing the chords in the original progressionto find a path through the representative subset ofZn/R.

    2. Generating all solutions that share the same normal-ized path.

    3. Choosing a solution with the desired characteristics.

    In the case of our example for three tenors, R would beOP and the desired characteristics would include specificranges for each voice.

    A sequence of equivalence classes represents manypossible concrete progressions, each with a unique paththrough Zn. In OP-space, choosing the specific shape ofthe path through a series of equivalence classes is anal-ogous to choosing a voice-leading behavior. For a chordspace, Zn/R and a sequence of concrete chords,X = [x0, ...,xm],xi Zn, the set of chord progressions shar-ing the same sequence of equivalence classes as X is:

    {[y0, ...,ym] |yi E(xi,Zn/R)} (4)

    We can further constrain this to some subset of Zn, limit-ing the range of each voice based on instrumental or per-former constraints.

    {[y0, ...,ym] |yi E(xi,S/R), S Zn} (5)

    Finally, we want solutions that exhibit desirable behav-ior, such as those having certain voice-leading characteris-tics (e.g. smooth voice-leadings, no voice crossings, etc.).Given a musical predicate, H, that defines what desirablebehavior is for a chord progression, we can further narrowthe set of candidate solutions:

    {[y1, ..., ym] |yi E(xi,S/R), S ZnH([y1, ..., ym])}(6)

    3.1. Musical Predicates

    We define two types of musical predicates: pairwise andprogression predicates. Pairwise predicates apply to pairsof chords, and progression predicates apply to a sequence,or progression of m chords.

    First we define a pairwise predicate that rejects caseswhere voice crossing occurs. When voices cross, a per-mutation that sorts one chords voices will not correctlysort the other chords voices.

    hnoCross(x,y) =

    Sn |(x) = sort(x)(y) = sort(y)(7)

    Similarly, we define pairwise predicates for avoidingparallel motion (when two voices move in the same direc-tion by the same amount) and for limiting the maximummovement of each voice.

    hnoPar(x1, ...,xn,y1, ...,yn) =i, j [1,n], i = j,yi xi = y j x j

    (8)

    hmaxDist(t,x1, ...,xn,y1, ...,yn) =xi,yi, | yi xi | t

    (9)

    Finally, given a pairwise predicate, hpair, a progres-sion predicate can be created from it.

    hprog(hpair, [x1, ..., xm]) =m1i=1

    hpair(xi, xi+1) (10)

    3.2. Algorithms for Applying Predicates

    Finding a chord progression satisfying certain predicatesis analogous to the satisfiability problem in computer sci-ence, which is NP-complete for arbitrary formulas onBoolean variables [7]. Because of this, there is a tractabil-ity issue involved in finding candidate solutions that sat-isfy one or more potentially arbitrary predicates. If thereare k possible choices for each of m chords in a progres-sion, there are km total possibilities. For a given quotientspace S/R and predicate H we clearly need a more effi-cient method for finding solutions than generating all R-equivalent solutions, storing them, and then looking forcases satisfyingH. An algorithm generatingH-acceptablesolutions must performmore aggressive pruning of the so-lution space.

    One way to prune the solution space is through theuse of predicates that operate on sub-progressions, suchas pairwise predicates. An algorithm can apply the pred-icates while generating partial solutions. We present onesuch algorithm below for pairwise predicates. While thisgeneral strategy does not change the complexity class ofthe problem, it avoids computing and storing unnecessaryprogressions.

    Algorithm 6. pairProg(R,S,hpair, [x1, ..., xm]) =

    1. If m = 1, return E(x1,S/R) = {z |z SzRx},otherwise continue.

    2. Let Y = pairProg(R,S,hpair, [x2, ..., xm])

    3. Return {[y1, y2, ...,ym] |y1 E(x1,S/R),[y2, ...,ym] Y, hpair(y1, y2)}.

    Even when solutions are filtered using predicates, thework involved in traversing the entire set of solutions tolocate desirable ones and even the number of desirablesolutions can be intractable in situations involving manychords, many voices, and/or large ranges for the voices.Fortunately, in music, rules are not always strict, and soit may be sufficient to find a solution that mostly satis-fies a set of predicates, even if some parts of the solutionviolate the predicates. We present an alternative, greedyalgorithm for generating chord progressions that, whilenot guaranteed to find a solution satisfying a progressionpredicate, will attempt to satisfy a pairwise predicate whenchoosing each chord.

    Algorithm 7. Let xi be the chord for which we wish tofind a new R-equivalent member of S Zn,yi. Letyi1 bethe previously chosen chord, choose(S) be a function tostochastically select an element from a set, andf (xi,yi1,E(xi,S/R)) be a fall-back method for choosingyi.

    greedyChord(xi,yi1,S Zn,R,Hpair, f ) =1. Let SH = {y E(xi,S/R) |Hpair(yi1,y)}2. If SH = /0 then return yi = f (xi,yi1,E(xi,S/R)).

    Otherwise, returnyi = choose(SH).

  • _438 _439

    Algorithm 8.greedyProg([x1, ...,xm], S Zn,R,Hpair, f ) = [y1, ...,ym],where

    yi =

    {choose(E(x1,S/R)) for i= 1greedyChord(xi,yi1,S,R,Hpair, f ) otherwise

    The main advantage to this approach is that the so-lution space is maximally pruned at each step. This al-lows the algorithm to operate on inputs that would causetractability problems for pairProg. The downside is thatgreedyProg is not guaranteed to find predicate-satisfyingsolutions. It is possible to find a partial solution with nosubsequent choices that satisfy the supplied predicate. Insuch a situation, there are three options: fail and returnan error message, backtrack to try to find a better solution(analogous to lazy evaluation of pairProg), or try anotherpredicate. For our implementation, we chose the latter:a fall-back method for choosing a next chord is thereforerequired if we wish to ensure that greedyProg produces asolution. In practice, it may be sufficient to have a resultthat mostly satisfies a predicate even if some chord tran-sitions do not. Since this greedy approach does not re-quire examining all possible solutions, it presents a moretractable option for larger-scale composition problems.

    3.3. Moving Between Levels of Abstraction

    Problems of solution space size mentioned so far are moreprominent for chord spaces with very large equivalenceclasses. For example, a given equivalence class in OP-space can be larger than inO-space. Similarly,OPT -spacewill have some larger classes than OP-space. However,before generating a final solution, we can move betweenlevels of abstraction using only representative subsets atintermediate steps.

    For example, it would be possible to find a path througha representative subset of OPT space using predicates onchord quality and then, in a second step, transform thatabstract path into one through Zn/OP with predicates toshape the voice-leadings. If we were to try to find so-lutions in OPT -space directly using a predicate for bothchord quality and voice-leading behavior, the number ofinitial possibilities to explore would be much larger.

    4. APPLICATION TO VOICE-LEADING

    We implemented the algorithms described in the previ-ous sections using Haskell, a lazy programming languagethat allows for a concise and elegant implementation.1

    We present examples relevant to our originally describedproblem: re-writing existing chord progressions. Dura-tions of chords shown in the examples do not change,since our algorithms only make decisions about the as-signment of pitches to voices (not duration).

    1Our implementation is available at the Yale Haskell Group website,http://haskell.cs.yale.edu/.

    Our results show potential as a framework for sometasks in automated composition. We control specific so-lution choice with the use of predicates and we use chordspaces as a way to organize the solution space at differ-ent levels of abstraction. Our results also highlight severalimportant issues in the representation of chord spaces forcompositional tasks as well as problems with the tractabil-ity of searching a particular solution space under a set ofpredicates.

    We present sample results using a three-voice inputprogression created by the authors, shown in Figure 1.This chord progression is then re-written using our al-gorithms and two different chord spaces: OP-space andOPT -space. The examples make use of the followingpredicates:

    hnoCross(a,b) = true iff no voice crossing occurs be-tweena andb.

    hnoPar(a,b) = true iff no parallel motion occurs be-tween any pair of voices ina andb.

    hmax7(a,b) = true iff no voice moves more than 7halfsteps froma tob.

    hall(a,b) =hnoCross(a,b)hnoPar(a,b)hmax7(a,b)

    hallProg(p) = hprog(hall , p)

    For the three-voice progression in Figure 1, two OP-equivalent and twoOPT -equivalent progressions are shown.Figures 2, 3, and 5 utilize the range of [36,57] for eachvoice. Figure 4 uses a representative subset of OP-spaceinstead. For the sake of score readability, we chose to usea version of this progression transposed up by 48 halfstepsto lie within [48,59]3 rather than [0,11]3.

    4.1. Greedy Algorithm Performance

    Using the same input progression, hall , and greedyProg,we ran an experiment to estimate the success rate ofgreedyProg. This progression demonstrates the tractabil-ity issues associated with the general problem of rewrit-ing chord progressions. There are 11 chords in the inputprogression, and, within the range [36,57]3, there are 24OP-equivalent ways to choose each of the first, second,and third chords and 48 ways to choose each of the re-maining eight chords. This gives a total of 243488 possi-ble OP-equivalent solutions. Of those solutions, we usedpairProg to determine that 901728 of them satisfy hallProgwithin the range [36,57]n.

    We ran 10000 trials with greedyProg to find OP-equivalent solutions to the input progression in Figure 1within the range [36,57]3. We used hmax7 as a fall-backmethod for greedyProg. Under these conditions, 8165of greedyProgs returned progressions satisfied hallProg.7406 of those hallProg-satisfying progressions were uniquesolutions. Of the 1835 returned progressions that violated

    hallProg, an average of only 1.1 chord transitions per pro-gression violated hall , with the highest number of hall-violating transitions being 2. We feel that greedyProg per-formed well in this experiment. However, the algorithmsperformance will be directly affected by the range of thevoices and specific predicate used. Decreasing the rangeof each voice, for example, would increase the odds thatgreedyProg would become stuck and rely on its fall-backfunction.

    444444

    Figure 1. A simple chord progression for three voices.

    444444

    Figure 2. A solution generated with greedyProg using[36,57]3/OP, figure 1s progression as input, and hall .

    444444

    Figure 3. A solution generated with pairProg using[36,57]3/OP, Figure 1s progression as input, and hall .

    4.2. Levels of Abstraction

    The OPT -equivalent progressions to Figure 1, Figures 4and 5 demonstrate use of different levels of abstractionfor rewriting chord progressions. Figure 4 is an OPT -equivalent progression to Figure 1 using SOP/OPT , whereSOP is a representative subset of OP-space lying within[48,59]3.

    Figure 5 is an OP-equivalent path to Figure 4 and anOPT -equivalent path to Figure 1. It is a randomly selectedsolution from the set generated by pairProg and hall . Be-cause the input progression from Figure 1 only consists ofmajor and minor trichords, its OPT -equivalent progres-sions are only required to share the same quality (majoror minor) for each chord.

    Although not exactly musical, the results from OPT -space are promising in some ways. OP-space can pro-duce musical results given appropriate predicates and a

    musical set of pitch classes as labels, but the same systemcan be generalized to make choices about more than justpitch class. Unfortunately, in our examples, OPT -spaceis too generalized to imitate the types of pitch class de-cisions humans might make, because the labels are onlyan indicator of chord quality. Ultimately, spaces with alevel of generality somewhere between OP- and OPT -space may be most useful, giving an intermediate numberof equivalence classes. For example, in a particular mu-sical context, two OP classes may be functionally equiva-lent and therefore could be merged. Finding more appro-priate, intermediate levels of abstraction may also requiremore complex spaces, with points holding more informa-tion than just pitches, such as home key. Additionally, thisframework may benefit for including additional conceptssuch as Morriss contour spaces for representing musicalfeatures more diverse than just chords [9].

    444444

    Figure 4. A solution generated with greedyProg withan always-true predicate and a transposed version ofSOP/OPT (4 octaves higher for readability)

    444444

    Figure 5. A solution generated with pairProg using[36,57]3/OP, Figure 4s progression as input, and hall .

    When using OP-space to choose voice-leadings forpitch classes, it may be also useful to learn a particularstyle or composers method of choosing voice-leadingsfrom a data set. Similarly, equivalence relations for con-cepts such as chord substitutions and short progressionscould be learned. Machine learning algorithms such asprobabilistic suffix trees [10] may aid in extracting rele-vant sub-progressions to learn concepts such as chord sub-stitution for use in more complex quotient spaces of shortchord progressions.

    4.3. Representing Equivalence Relations

    One shortcoming of our implementation is the need forsingle, Boolean tests for equivalence under multiple rela-tions. Partitioning a set under multiple relations createsrepresentational problems: either the space must be largeenough that it contains all intermediate points needed topreserve transitivity, or functions must be developed totest for equivalence under multiple relations in one Boolean

  • _438 _439

    Algorithm 8.greedyProg([x1, ...,xm], S Zn,R,Hpair, f ) = [y1, ...,ym],where

    yi =

    {choose(E(x1,S/R)) for i= 1greedyChord(xi,yi1,S,R,Hpair, f ) otherwise

    The main advantage to this approach is that the so-lution space is maximally pruned at each step. This al-lows the algorithm to operate on inputs that would causetractability problems for pairProg. The downside is thatgreedyProg is not guaranteed to find predicate-satisfyingsolutions. It is possible to find a partial solution with nosubsequent choices that satisfy the supplied predicate. Insuch a situation, there are three options: fail and returnan error message, backtrack to try to find a better solution(analogous to lazy evaluation of pairProg), or try anotherpredicate. For our implementation, we chose the latter:a fall-back method for choosing a next chord is thereforerequired if we wish to ensure that greedyProg produces asolution. In practice, it may be sufficient to have a resultthat mostly satisfies a predicate even if some chord tran-sitions do not. Since this greedy approach does not re-quire examining all possible solutions, it presents a moretractable option for larger-scale composition problems.

    3.3. Moving Between Levels of Abstraction

    Problems of solution space size mentioned so far are moreprominent for chord spaces with very large equivalenceclasses. For example, a given equivalence class in OP-space can be larger than inO-space. Similarly,OPT -spacewill have some larger classes than OP-space. However,before generating a final solution, we can move betweenlevels of abstraction using only representative subsets atintermediate steps.

    For example, it would be possible to find a path througha representative subset of OPT space using predicates onchord quality and then, in a second step, transform thatabstract path into one through Zn/OP with predicates toshape the voice-leadings. If we were to try to find so-lutions in OPT -space directly using a predicate for bothchord quality and voice-leading behavior, the number ofinitial possibilities to explore would be much larger.

    4. APPLICATION TO VOICE-LEADING

    We implemented the algorithms described in the previ-ous sections using Haskell, a lazy programming languagethat allows for a concise and elegant implementation.1

    We present examples relevant to our originally describedproblem: re-writing existing chord progressions. Dura-tions of chords shown in the examples do not change,since our algorithms only make decisions about the as-signment of pitches to voices (not duration).

    1Our implementation is available at the Yale Haskell Group website,http://haskell.cs.yale.edu/.

    Our results show potential as a framework for sometasks in automated composition. We control specific so-lution choice with the use of predicates and we use chordspaces as a way to organize the solution space at differ-ent levels of abstraction. Our results also highlight severalimportant issues in the representation of chord spaces forcompositional tasks as well as problems with the tractabil-ity of searching a particular solution space under a set ofpredicates.

    We present sample results using a three-voice inputprogression created by the authors, shown in Figure 1.This chord progression is then re-written using our al-gorithms and two different chord spaces: OP-space andOPT -space. The examples make use of the followingpredicates:

    hnoCross(a,b) = true iff no voice crossing occurs be-tweena andb.

    hnoPar(a,b) = true iff no parallel motion occurs be-tween any pair of voices ina andb.

    hmax7(a,b) = true iff no voice moves more than 7halfsteps froma tob.

    hall(a,b) =hnoCross(a,b)hnoPar(a,b)hmax7(a,b)

    hallProg(p) = hprog(hall , p)

    For the three-voice progression in Figure 1, two OP-equivalent and twoOPT -equivalent progressions are shown.Figures 2, 3, and 5 utilize the range of [36,57] for eachvoice. Figure 4 uses a representative subset of OP-spaceinstead. For the sake of score readability, we chose to usea version of this progression transposed up by 48 halfstepsto lie within [48,59]3 rather than [0,11]3.

    4.1. Greedy Algorithm Performance

    Using the same input progression, hall , and greedyProg,we ran an experiment to estimate the success rate ofgreedyProg. This progression demonstrates the tractabil-ity issues associated with the general problem of rewrit-ing chord progressions. There are 11 chords in the inputprogression, and, within the range [36,57]3, there are 24OP-equivalent ways to choose each of the first, second,and third chords and 48 ways to choose each of the re-maining eight chords. This gives a total of 243488 possi-ble OP-equivalent solutions. Of those solutions, we usedpairProg to determine that 901728 of them satisfy hallProgwithin the range [36,57]n.

    We ran 10000 trials with greedyProg to find OP-equivalent solutions to the input progression in Figure 1within the range [36,57]3. We used hmax7 as a fall-backmethod for greedyProg. Under these conditions, 8165of greedyProgs returned progressions satisfied hallProg.7406 of those hallProg-satisfying progressions were uniquesolutions. Of the 1835 returned progressions that violated

    hallProg, an average of only 1.1 chord transitions per pro-gression violated hall , with the highest number of hall-violating transitions being 2. We feel that greedyProg per-formed well in this experiment. However, the algorithmsperformance will be directly affected by the range of thevoices and specific predicate used. Decreasing the rangeof each voice, for example, would increase the odds thatgreedyProg would become stuck and rely on its fall-backfunction.

    444444

    Figure 1. A simple chord progression for three voices.

    444444

    Figure 2. A solution generated with greedyProg using[36,57]3/OP, figure 1s progression as input, and hall .

    444444

    Figure 3. A solution generated with pairProg using[36,57]3/OP, Figure 1s progression as input, and hall .

    4.2. Levels of Abstraction

    The OPT -equivalent progressions to Figure 1, Figures 4and 5 demonstrate use of different levels of abstractionfor rewriting chord progressions. Figure 4 is an OPT -equivalent progression to Figure 1 using SOP/OPT , whereSOP is a representative subset of OP-space lying within[48,59]3.

    Figure 5 is an OP-equivalent path to Figure 4 and anOPT -equivalent path to Figure 1. It is a randomly selectedsolution from the set generated by pairProg and hall . Be-cause the input progression from Figure 1 only consists ofmajor and minor trichords, its OPT -equivalent progres-sions are only required to share the same quality (majoror minor) for each chord.

    Although not exactly musical, the results from OPT -space are promising in some ways. OP-space can pro-duce musical results given appropriate predicates and a

    musical set of pitch classes as labels, but the same systemcan be generalized to make choices about more than justpitch class. Unfortunately, in our examples, OPT -spaceis too generalized to imitate the types of pitch class de-cisions humans might make, because the labels are onlyan indicator of chord quality. Ultimately, spaces with alevel of generality somewhere between OP- and OPT -space may be most useful, giving an intermediate numberof equivalence classes. For example, in a particular mu-sical context, two OP classes may be functionally equiva-lent and therefore could be merged. Finding more appro-priate, intermediate levels of abstraction may also requiremore complex spaces, with points holding more informa-tion than just pitches, such as home key. Additionally, thisframework may benefit for including additional conceptssuch as Morriss contour spaces for representing musicalfeatures more diverse than just chords [9].

    444444

    Figure 4. A solution generated with greedyProg withan always-true predicate and a transposed version ofSOP/OPT (4 octaves higher for readability)

    444444

    Figure 5. A solution generated with pairProg using[36,57]3/OP, Figure 4s progression as input, and hall .

    When using OP-space to choose voice-leadings forpitch classes, it may be also useful to learn a particularstyle or composers method of choosing voice-leadingsfrom a data set. Similarly, equivalence relations for con-cepts such as chord substitutions and short progressionscould be learned. Machine learning algorithms such asprobabilistic suffix trees [10] may aid in extracting rele-vant sub-progressions to learn concepts such as chord sub-stitution for use in more complex quotient spaces of shortchord progressions.

    4.3. Representing Equivalence Relations

    One shortcoming of our implementation is the need forsingle, Boolean tests for equivalence under multiple rela-tions. Partitioning a set under multiple relations createsrepresentational problems: either the space must be largeenough that it contains all intermediate points needed topreserve transitivity, or functions must be developed totest for equivalence under multiple relations in one Boolean

  • _440 _441

    test. In other words, if we wish to compute (S/R1)/R2, wemust find a suitable test, r, for R= R1R2 and then com-pute S/R directly instead of first finding Q = (S/R1) andthen computing Q/R2. As we have shown, this is possiblefor the OPT relations.

    It is not always possible to find simple and conciseformulas to combine multiple equivalence relations intosingle Boolean tests as we have done for all combinationsof the O, P, and T relations. In the case of OPT equiv-alence, we relied on understanding of the music theoreticaspects of the relations to create a simple Boolean test.Equivalence relations learned from data sets could requirestoring and traversing the entire learned model to performequivalence tests.

    Storing an entire chord space is also problematic, sincethe number of chords grows exponentially with the num-ber of voices. For large numbers of voices, it may be nec-essary to generate the quotient space on an as-needed ba-sis. These issues must be addressed in order to pursueapplications that involve large quotient spaces.

    4.4. Algorithms for Satisfying Predicates

    The size of the solution spaces demonstrated by our sim-ple examples shows the need for intelligent methods oftraversing these spaces without generating and storing eachpossible solution. With lazy evaluation in a language likeHaskell, it is relatively easy to calculate the first solutionthat satisfies some predicates. However, choosing a ran-dom solution requires knowing how many solutions exista priori.

    The greedyProg algorithm avoids this issue by mak-ing stochastic choices as it generates the solution. How-ever, the trade-off is the potential for becoming stuck, withno predicate-satisfying options for future choices. Onepossible improvement would be to incorporate back-tracking into an algorithm like greedyProg as a fall-backmethod when the algorithm becomes stuck. This type ofapproach would still allow for the selection of a random,predicate-satisfying solution without necessarily requir-ing generation of the entire solution space.

    5. CONCLUSIONS

    We have presented a general framework for rewriting chordprogressions using chord spaces and musical predicatesand added additional formalization to concepts importantfor implementing and using chord spaces. We have pre-sented two algorithms for generating chord progressionswithin this framework. Our greedy algorithm shows po-tential for avoiding tractability issues associated with thesize of musical solution spaces.

    We foresee algorithms like those presented here beinguseful in tasks such as algorithmic composition of novelmusic and arrangement of existing composition. Partic-ularly in the case of algorithmic composition, there is aneed to address structure at different levels of abstrac-tion. Chord spaces present one such method for movingbetween levels of abstraction, but other quotient spaces

    could be used as well, such as quotient spaces formedfrom sets of short progressions rather than sets of individ-uals chords. In our ongoing research, we are investigat-ing the construction of equivalence relations to form thesemore complex quotient spaces, as well as more efficientways to store and traverse them.

    Acknowledgements This research was supported in partby NSF grant CCF-0811665.

    6. REFERENCES

    [1] P. Buhlmann and A. J. Wyner, Varable lengthMarkov chains, The Annals of Statistics, vol. 27,no. 2, pp. 480513, 1999.

    [2] C. Callender, I. Quinn, and D. Tymoczko, General-ized voice-leading spaces, Science Magazine, vol.320, no. 5874, pp. 346348, 2008.

    [3] B. J. Clement, Learning harmonic progressionusing Markov models, in Genetic Algorithms inSearch, Optimization, and Machine Learning. Ad-dison Wesley, 1998.

    [4] D. Cope, An expert system for computer-assistedcomposition, Computer Music Journal, vol. 11,no. 4, pp. 3046, 1987.

    [5] , Computer modeling of musical intelligencein EMI, Computer Music Journal, vol. 16, no. 2,pp. 6983, 1992.

    [6] K. Ebcioglu, An expert system for Schenkeriansynthesis of chorales in the style of J.S. Bach, inICMC, 1984.

    [7] M. R. Garey and D. S. Johnson, Computers and In-tractability. W. H. Freeman and Company, 1979.

    [8] M. Mainetti, Symmetric operations on equivalencerelations, Annals of Combinatorics, vol. 7, pp. 325348, 2003.

    [9] R. D. Morris, Composition With Pitch-Classes: ATheory of Compositional Design. Yale UniversityPress, 1987.

    [10] D. Ron, Y. Singer, and S. Tishby, The power ofamnesia: Learning probabilistic automata with vari-able memory length, Machine Learning, vol. 25,pp. 117149, 1996.

    [11] D. Tymoczko, The geometry of musical chords,Science Magazine, vol. 313, no. 5783, pp. 7274,2006.

    [12] L. Yi and J. Goldsmith, Automatic generation offour-part harmony, in UAI Applications Workshop,2007.

    ASSISTANCE FOR NOVICE USERS ON CREATING SONGS FROMJAPANESE LYRICS

    Satoru Fukayama, Daisuke Saito, Shigeki Sagayama

    The University of TokyoGraduate School of Information Science and Technology

    7-3-1, Hongo, Bunkyo-ku, Tokyo, 113-8656, Japan{fukayama,dsaito,sagayama}@hil.t.u-tokyo.ac.jp

    ABSTRACT

    This paper describes a system designed to assist users increating original songs from Japanese lyrics with ease.Although software which helps in accomplishing this taskhas advanced recently, assisting users in going throughthe difficulties of composition is still a challenging task.We discuss a possible solution for assisting composersthrough three approaches; to design a system with direc-tion functionality in generating songs, to formulate com-position as an optimization problem, and to integrate asynthesis and analysis engine of vocals and lyrics. After54 days of operation of our implemented web-based sys-tem, 15,139 songs were automatically generated by 5,908distinct users. On average, 2.33 songs were generated peraccess to the website per user and a wide variety of com-position parameters were chosen for song generation. Theresults indicate that our method is able to greatly assistusers in generating original songs from Japanese lyrics.

    1. INTRODUCTION

    With recent advanced audio manipulation technologies andwidespread use of video sites on the Internet, it becamecommonplace to create original songs and broadcast thoseto the world. These situations can motivate potentialusers who are not skilled at composing or mixing mu-sic, but have a desire to create their original music. Manydifficulties of creating music have been overcome by theintroduction of technologies for music content manipula-tion. Digital audio workstation (DAW) has enabled usersto obtain tracks with high quality instrument sounds andedit music through cut and paste and adding audio ef-fects. Furthermore, focusing on the more detailed aspectsof composition, our research investigates how computerscan assist users in overcoming the difficulties of compos-ing melodies, especially when they do not have much pro-ficiency or pertaining to composition.

    Since early research on automatic composition withcomputers [1], discussions have been made on how com-puters can assist the users creation of musical composi-tions [2]. Graphical interfaces have been exploited forcomposition systems as well [3], which make it possi-ble for users to handle more abstract commands for musicgeneration. New computer languages and data structures

    have also been proposed for composition [4]. These lan-guages provided environments that enabled users to gen-erate music with algorithmic procedures. Computer sys-tems for editing acoustic events and music scores alsohave been proposed [5, 6]. These attempts raise ques-tions about what kind of interface is user-friendly in suchsystems. Interpretation of musical theoretical knowledgeand conventions of compositional methods in a form thatcomputers could handle is also looked into several ap-proaches; Expert-knowledge based systems [7], a systembased on constraints satisfaction [8], systems with geneticalgorithms [9], imitating musical styles with example basedprogramming [10], probabilistic modeling of music [11,13] and machine learning [14]. These approaches supportusers when they do not have enough technical backgroundon music or composition.

    The aim of this research is to design a system whichassists novice users in creating original songs easily. Byreviewing the previous automatic composition methodsfrom the viewpoint of composers assistance for noviceusers, three problems arise: (1) how to give directions ongenerating songs, (2) how to maintain consistency regard-ing musical theories, and (3) what the most easy-to-useinterface will be. In the following sections, we discussthe approaches taken to deal with these problems. Theyare (1) to design a system which combines the directionfunctionality on generating songs, (2) to formulate com-position as an optimization problem, and (3) to integrate asynthesis and analysis engine of vocal and lyrics.

    2. SYSTEM DESIGN FOR ASSISTANCE ONCREATING SONGS FROM JAPANESE LYRICS

    2.1. Design for giving directions on generating music

    2.1.1. Direction based on decomposed components

    In order to give directions on generating melodies of songs,providing examples of existing songs can be effective. Sincemusic can be broken down into components such as melody,harmony and rhythm, songs can be also decomposed intorhythm of melody, chord sequence, accompaniment andothers. In addition, these musical components correlatewith one another. For instance, when the chord sequenceis in a sad mood, the melody with that chord sequencetends to also be in a sad mood. Hence, posing direc-