In lieu of an abstract, here is a brief excerpt of the content:

  • Constraint Application with Higher-Order Programming for Modeling Music Theories
  • Torsten Anders and Eduardo R. Miranda

Modeling music theories with computer programs has attracted composers and scholars for a long time. On the one hand, the resulting programs can serve as algorithmic composition tools. On the other hand, such an approach leads to a better understanding of existing as well as newly developed theories, which in turn can lead to a better understanding of music, as well as to better ways to retrieve music from databases.

Constraint programming (Apt 2003) has often been used to create computational models of music theories and composition. Constraint-based harmonization systems were surveyed by Pachet and Roy (2001); other examples include purely rhythmic tasks (Sandred 2003), Fuxian counterpoint (Schottstaedt 1989), Ligeti-like textures (Chemillier and Truchet 2001; Laurson and Kuuskankare 2001), and instrument-specific writing (Laurson and Kuuskankare 2001).

Many music-constraint systems have been proposed in which users implement their own music theory models. Two seminal systems are PWConstraints (Laurson 1996) and Situation (Rueda et al. 1998). Carla (Courtot 1990) is one of the earliest systems. Other examples include the aggregation of the music representation MusES with the constraint system BackTalk (Pachet and Roy 1995), Arno (Anders 2000), OMClouds (Truchet and Codognet 2004), and Örjan Sandred’s PWMC defined on top of PWConstraints (Sandred 2010, in this issue). A survey of music-constraint programming in general and a detailed comparison of existing systems is provided by Anders and Miranda (in press).

Each system provides the following components, which are essential for solving musical constraint-satisfaction problems (CSP). It defines a music representation (score) where some aspects are represented as variables (unknowns). For example, the durations of notes in the score or the underlying harmonic structure may be unknown. Variables have a domain—a set of values they may take in a solution. The relations between these variables are restricted by constraints (rules), and a music-constraint system provides some mechanism for applying constraints to variables in the music representation. A CSP usually presents a combinatorial problem. A constraint solver finds one or more solutions for the problem. In a solution, the domain of each variable is reduced to a single value that is consistent with all of its constraints.

Nevertheless, existing systems differ widely; for example, they define diverse music representations. As a result, different systems are suitable for different types of CSPs. For instance, the system Situation is well suited for creating Messiaen-like chord progressions, and the PWConstraints subsystem Score-PMC supports complex polyphonic CSPs.

A constraint is often defined by a Boolean expression that involves a set of variables. This approach is fully generic; arbitrary constraints can be stated that way.

This article studies how constraints are applied to the score. How can we control which variable sets in the score are affected by a given constraint? Note that existing systems differ greatly in the mechanisms by which they apply constraints to the score. These mechanisms were often designed for convenience with specific uses in mind. For example, sets of score objects in a sequence (e.g., notes in a melody) are conveniently constrained in all systems. We will later survey existing constraint-application approaches in detail.

The problem is that complex sets of variables are hard to constrain with existing approaches. For example, a common contrapuntal constraint permits dissonant note pitches for passing tones on a weak [End Page 25] beat when the note is below a certain duration. This constraint involves a more complex variable set. It is difficult and sometimes even impossible to apply such complex constraints with approaches designed for very different use cases. On the other hand, using generic control structures such as iteration for the constraint application results in highly complex programs.


Click for larger view
View full resolution
Figure 1.

Solution to a music-constraint problem that models a conventional music theory.

We propose a formal approach based on functional programming that combines convenience with full generality. In this approach, a constraint is a first-class function. A first-class function is a function that can be treated as data; for example, it can be handed to another function as an argument (Abelson...

pdf

Share