Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/281557608

Computing with Chord Spaces

Conference Paper · September 2012

CITATIONS READS

6 93

2 authors, including:

Donya Quick
Stevens Institute of Technology
20 PUBLICATIONS   79 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

MUSICA: MUSical Improvising Collaborative Agent View project

Euterpea View project

All content following this page was uploaded by Donya Quick on 07 September 2015.

The user has requested enhancement of the downloaded file.


COMPUTING WITH CHORD SPACES

Donya Quick, Paul Hudak


Yale University
Department of Computer Science
New Haven, CT USA
donya.quick@yale.edu, paul.hudak@yale.edu

ABSTRACT about those chords, such as the pitch classes involved in


each. To assign a C-major triad to three voices, a spe-
The number of solutions involved in many algorithmic cific C, E, and G must be chosen. This involves choosing
composition problems is too large to be tractable with- octaves for each pitch class and determining which pitch
out simplification. Given this, it is critical that composi- should be assigned to each voice.
tion algorithms be able to move through different levels We use the term concrete chord to refer to chords with
of abstraction while maintaining a well-organized solu- no room for additional interpretation and the term ab-
tion space. In this paper we present the following con- stract chord when choices still exist. Voice-leading as-
tributions: (1) extended formalizations and proofs needed signment is the process of turning abstract chords into
to implement the chord spaces defined by Tymoczko [11] concrete chords. This is also representative of a larger
and Callender et al. [2], (2) a generalized framework for category of tasks in composition: moving between differ-
moving between levels of abstraction using quotient spaces ent levels of abstraction in music. Particularly for large
that can easily be integrated with existing algorithmic com- problems, the solution spaces must be well-structured and
position algorithms, and (3) an application of both to voice- efficient to traverse.
leading assignment. Our approach to voice-leading assignment uses a type
of quotient space called a chord space [2, 11]. Chord
1. INTRODUCTION spaces are a way to organize chords in musically mean-
ingful ways and provide a convenient, intermediate level
A major problem in the area of algorithmic composition of organization between abstract and concrete chords. For
is the need for organized and easily traversable sets of example, one such chord space groups chords based on
solutions, also referred to as solution spaces, which are pitch class content, providing a useful level of abstraction
tractable in terms of both runtime and memory require- for voice-leading assignment. We use this space to turn a
ments. Many music-theoretic ideas are also not formal- sequence of abstract chords represented in terms of pitch
ized to the degree necessary to ensure correct implemen- classes into a sequence of concrete chords. When finished,
tation of algorithms and accompanying data structures. each pitch class in each chord is assigned an octave and a
In this paper we address both of these problems by pre- particular voice.
senting a general framework for organizing and traversing There are many other chord spaces that relate chords
harmony-related solution spaces. Our work builds on that in different ways. These can also be used with our algo-
of of Tymoczko [11] and Callender et al. [2], adding an ad- rithm to perform variations on the voice-leading assign-
ditional layer of formalization necessary to create a gen- ment task, allowing the algorithm a greater degree of con-
eralized and extensible implementation. We then apply trol over what musical features are generated. By simply
our framework to the task of voice-leading assignment, a changing the chord space, our voice-leading assignment
common problem in music composition. algorithm can be generalized to make choices about pitch
Consider the following situation: given a sequence of classes and octaves.
chords intended for a soprano, tenor, and baritone, re- Data-driven algorithms such as Markov chains have
write the same chords for three tenors while factoring in been used to learn voice-leading behavior from collections
additional constraints about each performer – perhaps one of examples [3, 12]. Markov chains suffer from state ex-
of the performers is a beginner, requiring smooth voice- plosion when addressing low-level features in music while
leadings. This paper presents a set of algorithms and sup- still capturing structure. Variable-length Markov models
porting proofs to automate algorithmic composition and [1] and probabilistic suffix trees [10] attempt to address
arranging tasks such as above. Our approach utilizes two this problem, but are still prone to the same problem with
important concepts: chord spaces [2, 11] and musical pred- the large alphabets involved in musical problems. Chord
icates. spaces [2, 11] can help with this, since they allow gener-
A task such as outlined above will be referred to as ative problems to be broken into multiple steps, each at a
a voice-leading assignment. Our goal is to construct a different level of abstraction.
performable series of chords from incomplete information Chord spaces, however, present a number of repre-
sentational issues. Being a type of quotient space, chord to our discrete pitch space, Zn , as well. We make use of
spaces are specified with equivalence relations. When three of these equivalence relations:
combining two equivalence relations to produce a new one
or when applying more than one equivalence relation to • Octave equivalence, O. Chords belong to the same
a set to produce a quotient space, it is not always easy equivalence class if they have the same vectors of
to preserve properties like transitivity or to find an effi- pitch classes: ~v ∼O ~v + 12~i,~i ∈ Zn [2]. For exam-
cient representation for the relation or the quotient space. ple, h0, 4, 7i and h12, 4, 7i are O-equivalent; they are
We present additional formalizations and algorithms to both C-major triads where the voices have the pitch
address these types of representational issues for chord classes C, E, and G respectively.
spaces.
• Permutation equivalence, P. Chords with the same
Finally, algorithms that perform well at large-scale
multisets of pitches belong to the same equivalence
compositional tasks, such as those presented in the work
class under this relation. P can be defined using the
of Ebcioglu [6] and Cope [4, 5], tend to have application-
symmetric group of order n, Sn (the set of all per-
specific aspects to the implementations that make gen-
mutation functions for n elements):
eralization and reuse difficult. In this paper, we aim to
~v ∼P σ (~v), σ ∈ Sn [2]. For example, h0, 4, 7i and
achieve a general result that has application to any al-
h4, 0, 7i are P-equivalent.
gorithmic composition problem that requires moving be-
tween multiple levels of abstraction to find a solution. We • Transposition equivalence, T . Chords with the same
show one such application to voice-leading assignment. intervallic content belong to the same equivalence
Our approach utilizes chord spaces to organize the solu- class. For example, h0, 4, 7i and h1, 5, 8i are T -
tion space and controls voice-leading behavior (the exact equivalent. The relation is defined in [2] as
up/down movement in each voice from one chord to the ~v ∼T ~v + c1n , c ∈ R, but we further constrain the
next) through the use of musical predicates, which can definition by requiring c ∈ Z for the remainder of
easily be constructed to follow common music-theoretic this paper to be consistent with our discrete inter-
principles, such as prohibiting voice crossing and parallel pretation of pitches.
motion.
The O, P, and T relations can be used individually
or combined to produce additional equivalence relations.
2. CHORD SPACES
Two equivalence relations, R1 and R2 , can be combined
to make a new equivalence relation using the join opera-
We represent chords as vectors of integers, where every
tion, R1 ∨ R2 [8]. We will use the notation R+ to denote
integer represents a pitch. Middle C, (C,4), is the integer
the transitive closure of relation R. For two equivalence
60. (C#,4) is 61, and so on. Vectors are written as ~v to
relations, R1 and R2 , where R1 · R2 is the composition of
refer to a single vector and hx1 , x2 , ..., xn i to show all of the
the two relations:
vector’s elements. A chord is represented as a vector of
integers. The set of all possible chords of length n (having R1 ∨ R2 = (R1 · R2 ∪ R2 · R1 )+ (1)
n voices) is Zn . [a, b]n is the set of all vectors hx1 , ..., xn i
where a ≤ xi ≤ b. We write sequences of vectors using the The join operation is commutative, such that
notation [~v1 , ..., v~n ]. The notation 1n denotes the vector of R1 ∨ R2 = R2 ∨ R1 . For simplicity, we will abbreviate
length n whose elements are all 1. R1 ∨ R2 as simply R1 R2 . For two points x, y ∈ S,
A quotient space formed by applying relation R to
set S is denoted S/R. A chord space is a quotient space x ∼R1 R2 y ←→ ∃z ∈ S, x ∼R1 z ∼R2 y (2)
formed from Zn and an equivalence relation on chords
The join operation can be used to combine the OPT
(vectors). The quotient space formed from Zn and an
relations to produce four other equivalence relations de-
equivalence relation R is referred to as R-space. Two ele-
scribed in [2, 11]: OP, OT , PT , and OPT :
ments of the same equivalence class under R are said to be
R-equivalent. The notation E(x, S/R) denotes x’s equiva- • Octave and Transposition equivalence, OT .
lence class under S/R, namely {y ∈ S | y ∼R x}. ~v ∼OT ~v + 12~i + c1n ,~i ∈ Zn , c ∈ Z (or c ∈ R for mi-
Relations that form musically-meaningful partitions crotonal systems). Chords in the same equivalence
of Zn are useful for automated composition tasks. One class have the same intervallic structure when rep-
way to construct musically-meaningful equivalence rela- resented as vectors of pitch classes. For example,
tions is to exploit existing concepts in music theory, such h0, 4, 7i ∼OT h13, 5, 8i.
as the ideas of pitch class and transposition. Tymoczko
and Callender et al. introduce several such relations on • Octave and Permutation equivalence, OP.
chords, each based on some concept in music theory [11, ~v ∼OP σ (~v + 12~i),~i ∈ Zn , σ ∈ Sn . Chords in the
2]. Each relation is defined over vectors in Rn , which uses same equivalence class have the same multisets of
the same mapping of whole numbers to pitches but also al- pitch classes. For n = 3 voices, OP-space contains
lows for microtones (a pitch of 60.5 would be a microtone an equivalence class for all C-major triads, another
just above middle C). All of the relations are applicable for all C-minor triads, and so on.
• Permutation and Transposition equivalence, PT . Algorithm 3. normOP(~v) = normP(normO(~v))
~v ∼PT σ (~v + c1n ), σ ∈ Sn , c ∈ Z (or c ∈ R for mi-
crotonal systems). Chords in the same equivalence In other words, normOP is the composition of the nor-
class share the same intervallic structure of their malizations for P-equivalence and O-equivalence; i.e.
multisets of pitches. For example: normOP = normP · normO. Also note that normOP re-
turns chords falling within:
h0, 4, 7i ∼PT h5, 1, 8i.
SOP = {hx1 , x2 , ..., xn i ∈ [0, 11]n , x1 ≤ x2 ≤ ... ≤ xn }
• Octave, Permutation, and Transposition equivalence,
OPT . ~v ∼OP σ (~v + 12~i + c1n ),~i ∈ Zn , σ ∈ Sn , c ∈ For example, the chords: h0, 16, 7i and h12, 7, 4i are
Z. Chords in the same equivalence class have the OP-equivalent because:
same intervallic structure of their multisets of pitch
classes, capturing the notion of chord quality. For normOP(h0, 16, 7i) = h0, 4, 7i = normOP(h12, 7, 4i)
example, h0, 4, 7i ∼OPT h0, 3, 8i, where h0, 4, 7i is a
C-major triad and h0, 3, 8i is an A-flat-major triad. In this case, the OP-equivalence class is that of C-major
This can be seen as follows: triads: chords containing the pitch classes C, E, and G.
That normOP can be defined as the composition of
h0, 4, 7i ∼O h12, 4, 7i ∼T h8, 0, 3i ∼P h0, 3, 8i
the normalizations for O and P is a special case. Given
normalizations f1 and f2 for relations R1 and R2 respec-
2.1. Normalizations and Representative Subsets
tively, there is no guarantee that f1 and f2 can be simply
To construct and use a chord space under relation R, it composed to create a proper normalization for the new
must be possible to test the R-equivalence of two chords. equivalence relation.
Points a and b are related under R if (a, b) ∈ R. However, Indeed, even the order of composition is important. If
if R is large (possibly infinite), such a search can be com- we were to reverse the order of composition in the defini-
putationally intractible. Indeed, because Zn is infinite, all tion of normOP, i.e. apply the normalization for P-space
of the spaces formed by O, P, and T are also infinite. first (sort) and then the normalization for O-space (take all
To address this problem, we take the following com- pitches mod12), points that should be OP-equivalent are
putational approach: for a set S, relation R, and quotient mapped differently, thereby breaking one of the require-
space S/R, rather than enumerate the entire equivalence ments for a representative subset (that all OP-equivalent
class of an element s ∈ S, we compute a representative points must map to the same representative point). For ex-
point of that equivalence class. We refer to the set of all ample, recall from above that h0, 16, 7i and h12, 7, 4i are
representative points as the representative subset of S/R, OP-equivalent. But if we reverse the order of composi-
which we denote by SR . If a function f : S → SR has the tion, let’s call it normOP0 , we have normOP0 (h0, 16, 7i) =
property that every point in S is R-equivalent to exactly h0, 7, 4i, whereas normOP0 (h12, 7, 4i) = h4, 7, 0i.
one point in SR , it is called a normalization. More for- Equivalence relations can have more than one normal-
mally: ization, and different normalizations may be needed un-
der different circumstances. This is easily seen for T -
Definition 1. SR ⊆ S is a representative subset for S/R iff equivalence.
∀x ∈ S, there is only one y ∈ SR such that x ∼R y.
Theorem 1. Let F = { f1 , ..., fn } be the set of functions
Definition 2. f is a normalization for the quotient space fi = (hx1 , ..., xn i) = hx1 − xi , ..., xn − xi i. An algorithm A :
S/R whenever ∀x, y ∈ S, f (x) = f (y) ←→ x ∼R y Zn → Zn is a normalization for Zn /T iff, for all ~x ∈ Zn ,
For example, a normalization for O, denoted as normO, it applies the same fi to all members of ~x’s equivalence
is straightforward: class, E(~x, Zn /T ).

Algorithm 1. Proof. Recall that ~x ∼t ~y ←→ ∃c ∈ Z,~x = ~y + c1n . Two


chords are T -equivalent if they have the same intervallic
normO(hx1 , ..., xn i) = hx1 mod 12, ..., xn mod 12i) structure.
If normO(x) = normO(y) we know that x and y belong • Let ~x = hx1 , ..., xn i,~y = hy1 , ..., yn i.
to the same O-equivalence class.
A normalization for P is similarly straightforward: • Let ~x0 = hx1 −xi , ..., xn −xi i, ~y0 = hy1 −yi , ..., yn −yi i
for some i ∈ Z.
Algorithm 2. normP(~v) = sort(~v)
• If ~x and ~y have the same intervallic structure (the
where sort : Zn → Zn arranges a vector’s elements in definition of T -equivalence), then ~x0 and ~y0 will be
ascending order. Thus if normP(x) = normP(y) we know equal and the ith element of both ~x0 and ~y0 will be
that x and y belong to the same P-equivalence class. 0. We therefore have that c = xi − yi and ~x ∼T ~x0 =
Proofs that both normO and normP are normalizations ~y0 ∼T ~y.
for their respective spaces are trivial and are omitted.
Consider now OP-equivalence. A suitable normaliza- • If ~x and ~y are not T -equivalent, then the intervallic
tion algorithm can be defined as: structures are different and ~x0 6= ~y0 .
Therefore, A(~x) = A(~y) ←→~x ∼T ~y. The proof that this is a normalization also follows di-
rectly from theorem 2.
Corollary 1. The following function: Finding a normalization is not always the most effi-
cient way to check for equivalence class membership. An
normT (hx1 , ..., xn i) = hx1 − x1 , ..., xn − x1 i (3)
example of this is OPT -equivalence. While a convenient
which subtracts the first element of a vector from all other representative subset of OPT -space exists, the set of all
elements, is a normalization for Zn /T . vectors in [0, 11]n whose first element is zero and whose
intervals between elements are sorted in ascending order
The order-of-composition problem also exists for OT - [2, 11], it is not easy to normalize chords into this subset
equivalence. The normalizations for O and T can be com- of Zn /OPT . The reason for this is illustrated by the points
posed in one order to produce a proper normalization for h0, 2, 7i and h0, 5, 7i, which are related by:
OT , but not the other. This can be summarized as a more
generalized theorem: h0, 5, 7i ∼O h12, 5, 7i ∼P h5, 7, 12i ∼T h0, 2, 7i

Theorem 2. If relations R1 and R2 have normalizations f1 The point h0, 5, 7i should, therefore, be normalized to
and f2 , respectively, with ranges S1 and S2 , respectively, h0, 2, 7i under the conventions of our representative sub-
such that S1 ∩ S2 6= 0,/ then if f3 = f1 · f2 has the range set. However, we cannot use any of the normalizations
S3 = S1 ∩ S2 , then f3 is a normalization for R1 ∨ R2 . discussed so far to accomplish this. h0, 5, 7i will be mapped
to itself with normP, normO, and normT . The same thing
Proof. From definition 1, S1 and S2 are representative sub- happens with h0, 2, 7i as well. Therefore, we have two
sets for R1 and R2 respectively. Every point in a represen- choices: create one or more new normalizations, or use
tative subset for some relation R belongs to a different R- another algorithm to test whether two chords are OPT -
equivalence class. When applying additional equivalence equivalent.
relations to a set, the number of equivalence classes can We have chosen to use another algorithm that, although
never increase. If an element is in S1 − S2 , it must be R2 - makes use of the O, P, and T normalizations, does not
equivalent to an element in S1 ∩ S2 . Similarly, elements define a normalization for the OPT relation itself. This
in S2 − S1 must be R1 -equivalent to elements in S1 ∩ S2 . algorithm returns true if and only if two chords are OPT -
S3 is therefore the only set of points which are not R1 R2 - equivalent.
equivalent to each other. Therefore, every point outside
of S1 ∩ S2 will map to only one point in S3 , meeting the Algorithm 5. optEq(~x,~y) =
requirements for f3 to be a normalization and S3 to be a
1. Let ~x0 = normOP(~x), ~y0 = normOP(~y).
representative subset for R1 R2 .
2. Let S~y = {normPT (~y + 12~i) |~i ∈ [0, 1]n ∧~i 6= 1n }.
Corollary 2. The function normOT = normO · normT is
a normalization for Zn /OT . 3. If ~x0 ∈ S~y then return true, otherwise return false.
Proof. Recall that ~x ∼OT ~y ←→~x =~y + 12~i + c~1. Two chords are OPT -equivalent if some stacking of
• normT ’s range is ST 1 = {h0, x2 , ..., xn i ∈ Zn }. their pitch classes have the same multiset of intervals. S~y
includes all possible sorted intervallic structures of~y’s pitch
• normO’s range is SO = [0, 11]n . classes. We have that ~x0 ∈ [0, 11]n , ~x0 is sorted, and S~y in-
cludes all sorted, OPT -equivalent vectors to ~y within the
• normOT ’s range is SOT = {h0, x2 , ..., xn i ∈ [0, 11]n }. range [0, 11]n . Therefore ~x0 ∈ S~y ←→~x ∼OPT ~y.
SOT = SO ∩ ST 1 , therefore normOT is a normalization for
OT . 3. GENERATING CHORD PROGRESSIONS

Corollary 3. Algorithm 3, normOP, is a normalization Finding a normalization for a chord space is important
for OP-space. because it is one way to determine which chords belong
to the same equivalence class. Many progressions will
Proof. share the same pattern of representative points when their
chords are normalized, so the process of rewriting har-
• normO’s range is [0, 11]n .
mony for n voices using chord spaces can be modeled as
• normP’s range is SP = {~x ∈ Zn |~x = sort(~x)} a three-step process:

• normOP’s range is SOP = {~x ∈ [0, 11]n |~x = sort(~x)} 1. Normalizing the chords in the original progression
to find a path through the representative subset of
SOP = [0, 11]n ∩ SP , therefore normOP is a normalization Zn /R.
for OP.
2. Generating all solutions that share the same normal-
A normalization also exists for PT : ized path.
Algorithm 4. normPT = normT · normP 3. Choosing a solution with the desired characteristics.
In the case of our example for three tenors, R would be 3.2. Algorithms for Applying Predicates
OP and the desired characteristics would include specific
Finding a chord progression satisfying certain predicates
ranges for each voice.
is analogous to the satisfiability problem in computer sci-
A sequence of equivalence classes represents many
ence, which is NP-complete for arbitrary formulas on
possible concrete progressions, each with a unique path
Boolean variables [7]. Because of this, there is a tractabil-
through Zn . In OP-space, choosing the specific shape of
ity issue involved in finding candidate solutions that sat-
the path through a series of equivalence classes is anal-
isfy one or more potentially arbitrary predicates. If there
ogous to choosing a voice-leading behavior. For a chord
are k possible choices for each of m chords in a progres-
space, Zn /R and a sequence of concrete chords,
sion, there are km total possibilities. For a given quotient
X = [~x0 , ...,~xm ],~xi ∈ Zn , the set of chord progressions shar-
space S/R and predicate H we clearly need a more effi-
ing the same sequence of equivalence classes as X is:
cient method for finding solutions than generating all R-
{[~y0 , ...,~ym ] |~yi ∈ E(~xi , Zn /R)} (4) equivalent solutions, storing them, and then looking for
cases satisfying H. An algorithm generating H-acceptable
We can further constrain this to some subset of Zn , limit- solutions must perform more aggressive pruning of the so-
ing the range of each voice based on instrumental or per- lution space.
former constraints. One way to prune the solution space is through the
use of predicates that operate on sub-progressions, such
{[~y0 , ...,~ym ] |~yi ∈ E(~xi , S/R), S ⊆ Zn } (5) as pairwise predicates. An algorithm can apply the pred-
icates while generating partial solutions. We present one
Finally, we want solutions that exhibit desirable behav- such algorithm below for pairwise predicates. While this
ior, such as those having certain voice-leading characteris- general strategy does not change the complexity class of
tics (e.g. smooth voice-leadings, no voice crossings, etc.). the problem, it avoids computing and storing unnecessary
Given a musical predicate, H, that defines what desirable progressions.
behavior is for a chord progression, we can further narrow
the set of candidate solutions: Algorithm 6. pairProg(R, S, h pair , [~
x1 , ..., x~m ]) =
1. If m = 1, return E(~x1 , S/R) = {~z |~z ∈ S ∧~z ∼R ~x},
y1 , ..., y~m ] |~yi ∈ E(~xi , S/R), S ⊆ Zn ∧ H([~
{[~ y1 , ..., y~m ])}
otherwise continue.
(6)
2. Let Y = pairProg(R, S, h pair , [~
x2 , ..., x~m ])
3.1. Musical Predicates
3. Return {[~ y1 , y~2 , ...,~ym ] | y~1 ∈ E(~x1 , S/R),
We define two types of musical predicates: pairwise and y2 , ...,~ym ] ∈ Y, h pair (~
[~ y1 , y~2 )}.
progression predicates. Pairwise predicates apply to pairs
of chords, and progression predicates apply to a sequence, Even when solutions are filtered using predicates, the
or progression of m chords. work involved in traversing the entire set of solutions to
First we define a pairwise predicate that rejects cases locate desirable ones and even the number of desirable
where voice crossing occurs. When voices cross, a per- solutions can be intractable in situations involving many
mutation that sorts one chord’s voices will not correctly chords, many voices, and/or large ranges for the voices.
sort the other chord’s voices. Fortunately, in music, rules are not always strict, and so
it may be sufficient to find a solution that mostly satis-
hnoCross (~x,~y) = fies a set of predicates, even if some parts of the solution
(7)
∃σ ∈ Sn | σ (~x) = sort(~x) ∧ σ (~y) = sort(~y) violate the predicates. We present an alternative, greedy
algorithm for generating chord progressions that, while
Similarly, we define pairwise predicates for avoiding not guaranteed to find a solution satisfying a progression
parallel motion (when two voices move in the same direc- predicate, will attempt to satisfy a pairwise predicate when
tion by the same amount) and for limiting the maximum choosing each chord.
movement of each voice.
Algorithm 7. Let ~xi be the chord for which we wish to
hnoPar (hx1 , ..., xn i, hy1 , ..., yn i) = find a new R-equivalent member of S ⊂ Zn , ~yi . Let ~yi−1 be
(8)
∀i, j ∈ [1, n], i 6= j, yi − xi 6= y j − x j the previously chosen chord, choose(S0 ) be a function to
stochastically select an element from a set, and
hmaxDist (t, hx1 , ..., xn i, hy1 , ..., yn i) = f (~xi ,~yi−1 , E(~xi , S/R)) be a fall-back method for choosing
(9) ~yi .
∀xi , yi , | yi − xi | ≤ t
Finally, given a pairwise predicate, h pair , a progres- greedyChord(~xi ,~yi−1 , S ⊆ Zn , R, H pair , f ) =
sion predicate can be created from it.
1. Let SH = {~y ∈ E(~xi , S/R) | H pair (~yi−1 ,~y)}
m−1
^
h prog (h pair , [~
x1 , ..., x~m ]) = h pair (~xi , x~i+1 ) (10) 2. If SH = 0/ then return ~yi = f (~xi ,~yi−1 , E(~xi , S/R)).
i=1 Otherwise, return ~yi = choose(SH ).
Algorithm 8. Our results show potential as a framework for some
greedyProg([~x1 , ...,~xm ], S ⊆ Zn , R, H pair , f ) = [~y1 , ...,~ym ], tasks in automated composition. We control specific so-
where lution choice with the use of predicates and we use chord
( spaces as a way to organize the solution space at differ-
choose(E(~x1 , S/R)) for i = 1 ent levels of abstraction. Our results also highlight several
~yi =
greedyChord(~xi ,~yi−1 , S, R, H pair , f ) otherwise important issues in the representation of chord spaces for
compositional tasks as well as problems with the tractabil-
The main advantage to this approach is that the so- ity of searching a particular solution space under a set of
lution space is maximally pruned at each step. This al- predicates.
lows the algorithm to operate on inputs that would cause We present sample results using a three-voice input
tractability problems for pairProg. The downside is that progression created by the authors, shown in Figure 1.
greedyProg is not guaranteed to find predicate-satisfying This chord progression is then re-written using our al-
solutions. It is possible to find a partial solution with no gorithms and two different chord spaces: OP-space and
subsequent choices that satisfy the supplied predicate. In OPT -space. The examples make use of the following
such a situation, there are three options: fail and return predicates:
an error message, backtrack to try to find a better solution
(analogous to lazy evaluation of pairProg), or try another • hnoCross (~a,~b) = true iff no voice crossing occurs be-
predicate. For our implementation, we chose the latter: tween ~a and ~b.
a fall-back method for choosing a next chord is therefore
• hnoPar (~a,~b) = true iff no parallel motion occurs be-
required if we wish to ensure that greedyProg produces a
solution. In practice, it may be sufficient to have a result tween any pair of voices in ~a and ~b.
that mostly satisfies a predicate even if some chord tran-
• hmax7 (~a,~b) = true iff no voice moves more than 7
sitions do not. Since this greedy approach does not re-
quire examining all possible solutions, it presents a more halfsteps from ~a to ~b.
tractable option for larger-scale composition problems.
• hall (~a,~b) =
hnoCross (~a,~b) ∧ hnoPar (~a,~b) ∧ hmax7 (~a,~b)
3.3. Moving Between Levels of Abstraction
• hallProg (p) = h prog (hall , p)
Problems of solution space size mentioned so far are more
prominent for chord spaces with very large equivalence For the three-voice progression in Figure 1, two OP-
classes. For example, a given equivalence class in OP- equivalent and two OPT -equivalent progressions are shown.
space can be larger than in O-space. Similarly, OPT -space Figures 2, 3, and 5 utilize the range of [36,57] for each
will have some larger classes than OP-space. However, voice. Figure 4 uses a representative subset of OP-space
before generating a final solution, we can move between instead. For the sake of score readability, we chose to use
levels of abstraction using only representative subsets at a version of this progression transposed up by 48 halfsteps
intermediate steps. to lie within [48, 59]3 rather than [0, 11]3 .
For example, it would be possible to find a path through
a representative subset of OPT space using predicates on 4.1. Greedy Algorithm Performance
chord quality and then, in a second step, transform that
abstract path into one through Zn /OP with predicates to Using the same input progression, hall , and greedyProg,
shape the voice-leadings. If we were to try to find so- we ran an experiment to estimate the success rate of
lutions in OPT -space directly using a predicate for both greedyProg. This progression demonstrates the tractabil-
chord quality and voice-leading behavior, the number of ity issues associated with the general problem of rewrit-
initial possibilities to explore would be much larger. ing chord progressions. There are 11 chords in the input
progression, and, within the range [36, 57]3 , there are 24
OP-equivalent ways to choose each of the first, second,
4. APPLICATION TO VOICE-LEADING
and third chords and 48 ways to choose each of the re-
maining eight chords. This gives a total of 243 488 possi-
We implemented the algorithms described in the previ-
ble OP-equivalent solutions. Of those solutions, we used
ous sections using Haskell, a lazy programming language
pairProg to determine that 901728 of them satisfy hallProg
that allows for a concise and elegant implementation.1
within the range [36, 57]n .
We present examples relevant to our originally described
We ran 10000 trials with greedyProg to find OP-
problem: re-writing existing chord progressions. Dura-
equivalent solutions to the input progression in Figure 1
tions of chords shown in the examples do not change,
within the range [36, 57]3 . We used hmax7 as a fall-back
since our algorithms only make decisions about the as-
method for greedyProg. Under these conditions, 8165
signment of pitches to voices (not duration).
of greedyProg’s returned progressions satisfied hallProg .
1 Our implementation is available at the Yale Haskell Group website, 7406 of those hallProg -satisfying progressions were unique
http://haskell.cs.yale.edu/. solutions. Of the 1835 returned progressions that violated
hallProg , an average of only 1.1 chord transitions per pro- musical set of pitch classes as labels, but the same system
gression violated hall , with the highest number of hall - can be generalized to make choices about more than just
violating transitions being 2. We feel that greedyProg per- pitch class. Unfortunately, in our examples, OPT -space
formed well in this experiment. However, the algorithm’s is too generalized to imitate the types of pitch class de-
performance will be directly affected by the range of the cisions humans might make, because the labels are only
voices and specific predicate used. Decreasing the range an indicator of chord quality. Ultimately, spaces with a
of each voice, for example, would increase the odds that level of generality somewhere between OP- and OPT -
greedyProg would become stuck and rely on its fall-back space may be most useful, giving an intermediate number
function. of equivalence classes. For example, in a particular mu-
sical context, two OP classes may be functionally equiva-
 4         lent and therefore could be merged. Finding more appro-
priate, intermediate levels of abstraction may also require
 4         more complex spaces, with points holding more informa-
 4      tion than just pitches, such as home key. Additionally, this
   framework may benefit for including additional concepts
such as Morris’s contour spaces for representing musical
Figure 1. A simple chord progression for three voices. features more diverse than just chords [9].

 4             4           
 4             4           
 4             4           
Figure 4. A solution generated with greedyProg with
an always-true predicate and a transposed version of
Figure 2. A solution generated with greedyProg using
SOP /OPT (4 octaves higher for readability)
[36, 57]3 /OP, figure 1’s progression as input, and hall .

  4              4           


 4        4      
  4              4           
Figure 5. A solution generated with pairProg using
Figure 3. A solution generated with pairProg using [36, 57]3 /OP, Figure 4’s progression as input, and hall .
[36, 57]3 /OP, Figure 1’s progression as input, and hall .
When using OP-space to choose voice-leadings for
pitch classes, it may be also useful to learn a particular
4.2. Levels of Abstraction style or composer’s method of choosing voice-leadings
from a data set. Similarly, equivalence relations for con-
The OPT -equivalent progressions to Figure 1, Figures 4
cepts such as chord substitutions and short progressions
and 5 demonstrate use of different levels of abstraction
could be learned. Machine learning algorithms such as
for rewriting chord progressions. Figure 4 is an OPT -
probabilistic suffix trees [10] may aid in extracting rele-
equivalent progression to Figure 1 using SOP /OPT , where
vant sub-progressions to learn concepts such as chord sub-
SOP is a representative subset of OP-space lying within
stitution for use in more complex quotient spaces of short
[48, 59]3 .
chord progressions.
Figure 5 is an OP-equivalent path to Figure 4 and an
OPT -equivalent path to Figure 1. It is a randomly selected
4.3. Representing Equivalence Relations
solution from the set generated by pairProg and hall . Be-
cause the input progression from Figure 1 only consists of One shortcoming of our implementation is the need for
major and minor trichords, its OPT -equivalent progres- single, Boolean tests for equivalence under multiple rela-
sions are only required to share the same quality (major tions. Partitioning a set under multiple relations creates
or minor) for each chord. representational problems: either the space must be large
Although not exactly musical, the results from OPT - enough that it contains all intermediate points needed to
space are promising in some ways. OP-space can pro- preserve transitivity, or functions must be developed to
duce musical results given appropriate predicates and a test for equivalence under multiple relations in one Boolean
test. In other words, if we wish to compute (S/R1 )/R2 , we could be used as well, such as quotient spaces formed
must find a suitable test, r, for R = R1 ∨ R2 and then com- from sets of short progressions rather than sets of individ-
pute S/R directly instead of first finding Q = (S/R1 ) and uals chords. In our ongoing research, we are investigat-
then computing Q/R2 . As we have shown, this is possible ing the construction of equivalence relations to form these
for the OPT relations. more complex quotient spaces, as well as more efficient
It is not always possible to find simple and concise ways to store and traverse them.
formulas to combine multiple equivalence relations into
single Boolean tests as we have done for all combinations Acknowledgements This research was supported in part
of the O, P, and T relations. In the case of OPT equiv- by NSF grant CCF-0811665.
alence, we relied on understanding of the music theoretic
aspects of the relations to create a simple Boolean test. 6. REFERENCES
Equivalence relations learned from data sets could require
storing and traversing the entire learned model to perform [1] P. Buhlmann and A. J. Wyner, “Varable length
equivalence tests. Markov chains,” The Annals of Statistics, vol. 27,
Storing an entire chord space is also problematic, since no. 2, pp. 480–513, 1999.
the number of chords grows exponentially with the num- [2] C. Callender, I. Quinn, and D. Tymoczko, “General-
ber of voices. For large numbers of voices, it may be nec- ized voice-leading spaces,” Science Magazine, vol.
essary to generate the quotient space on an as-needed ba- 320, no. 5874, pp. 346–348, 2008.
sis. These issues must be addressed in order to pursue
applications that involve large quotient spaces. [3] B. J. Clement, “Learning harmonic progression
using Markov models,” in Genetic Algorithms in
4.4. Algorithms for Satisfying Predicates Search, Optimization, and Machine Learning. Ad-
dison Wesley, 1998.
The size of the solution spaces demonstrated by our sim-
ple examples shows the need for intelligent methods of [4] D. Cope, “An expert system for computer-assisted
traversing these spaces without generating and storing each composition,” Computer Music Journal, vol. 11,
possible solution. With lazy evaluation in a language like no. 4, pp. 30–46, 1987.
Haskell, it is relatively easy to calculate the first solution
that satisfies some predicates. However, choosing a ran- [5] ——, “Computer modeling of musical intelligence
dom solution requires knowing how many solutions exist in EMI,” Computer Music Journal, vol. 16, no. 2,
a priori. pp. 69–83, 1992.
The greedyProg algorithm avoids this issue by mak- [6] K. Ebcioglu, “An expert system for Schenkerian
ing stochastic choices as it generates the solution. How- synthesis of chorales in the style of J.S. Bach,” in
ever, the trade-off is the potential for becoming stuck, with ICMC, 1984.
no predicate-satisfying options for future choices. One
possible improvement would be to incorporate back- [7] M. R. Garey and D. S. Johnson, Computers and In-
tracking into an algorithm like greedyProg as a fall-back tractability. W. H. Freeman and Company, 1979.
method when the algorithm becomes stuck. This type of
approach would still allow for the selection of a random, [8] M. Mainetti, “Symmetric operations on equivalence
predicate-satisfying solution without necessarily requir- relations,” Annals of Combinatorics, vol. 7, pp. 325–
ing generation of the entire solution space. 348, 2003.
[9] R. D. Morris, Composition With Pitch-Classes: A
5. CONCLUSIONS Theory of Compositional Design. Yale University
Press, 1987.
We have presented a general framework for rewriting chord
progressions using chord spaces and musical predicates [10] D. Ron, Y. Singer, and S. Tishby, “The power of
and added additional formalization to concepts important amnesia: Learning probabilistic automata with vari-
for implementing and using chord spaces. We have pre- able memory length,” Machine Learning, vol. 25,
sented two algorithms for generating chord progressions pp. 117–149, 1996.
within this framework. Our greedy algorithm shows po-
tential for avoiding tractability issues associated with the [11] D. Tymoczko, “The geometry of musical chords,”
size of musical solution spaces. Science Magazine, vol. 313, no. 5783, pp. 72–74,
We foresee algorithms like those presented here being 2006.
useful in tasks such as algorithmic composition of novel [12] L. Yi and J. Goldsmith, “Automatic generation of
music and arrangement of existing composition. Partic- four-part harmony,” in UAI Applications Workshop,
ularly in the case of algorithmic composition, there is a 2007.
need to address structure at different levels of abstrac-
tion. Chord spaces present one such method for moving
between levels of abstraction, but other quotient spaces

View publication stats

You might also like