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

  • Optimizing Chew and Chen's Pitch-Spelling Algorithm
  • David Meredith

Pitch-spelling algorithms attempt to compute the correct pitch names (e.g., C#4, B5) of the notes in a passage of tonal music, when given only the onset time, MIDI note number, and possibly the duration and voice of each note. This article reports on a study in which Chew and Chen's (2003a, 2003b, 2005) pitch-spelling algorithm was re-implemented and then optimized by running it with a range of different parameter value combinations on a test corpus containing 195,972 notes and consisting of 216 movements from works by eight Baroque and Classical composers. The results of this evaluation cast doubt upon some of the claims made by Chew and Chen that were based on results obtained by running their algorithm on a much smaller test corpus containing only 4,462 notes and consisting of just two movements from sonatas by Beethoven and You-Di Huang's Song of Ali-Shan. The results presented here suggest that Chew and Chen's algorithm could be simplified in various ways without compromising its performance.


There are good practical and scientific reasons for attempting to develop a reliable pitch-spelling algorithm. For example, such an algorithm must be incorporated into any system for transcribing music from audio or MIDI to staff notation. Furthermore, encoding the pitch names of the notes in a collection of MIDI files can make certain music information retrieval tasks more effective (Meredith 2006). Developing a reliable pitch-spelling algorithm can also further our understanding of the cognitive mechanisms that underlie the perception and cognition of tonal music. For example, Temperley (2001, p. 122) claims that "recognizing spelling distinctions" (i.e., identifying the pitch names of the notes in a piece) is "of direct experiential importance, for pitches, chords, and keys" and "provides useful input in harmonic and key analysis."

Pitch-spelling algorithms have been developed by a number of researchers aside from Chew and Chen, including Longuet-Higgins (1976, 1987a, 1993), Cambouropoulos (1996, 1998, 2001, 2003), Temperley (2001), Honingh (2006), Stoddard et al. (2004), and Meredith (2003, 2005, 2006, 2007). My dissertation (Meredith 2007) provides a detailed analysis and evaluation of my ps13 algorithm together with the algorithms proposed by Longuet-Higgins, Cambouropoulos, Chew and Chen, and Temperley. To set the current discussion in context, brief descriptions of Temperley and Sleator's Melisma system and my ps13 algorithm will now be given.

Using Temperley and Sleator's Melisma System for Pitch Spelling

Temperley's (2001) theory of music cognition consists of preference rule systems for six aspects of musical structure: meter, phrasing, counterpoint, harmony, key, and pitch spelling. Most of this theory has been implemented by Daniel Sleator in a suite of computer programs called Melisma (available on-line at These programs take "note list" representations as input in which the pitch of each note (or sequence of tied notes) is represented by its MIDI note number, and its onset-time and offset-time are given in milliseconds. In Temperley's theory, the tonal pitch class (TPC) of a note is an integer that indicates the position of the pitch name class of the note on the line of fifths.

Temperley's theory of pitch spelling consists of three "tonal-pitch-class preference rules" (TPRs). He claims that TPR 1, which states that notes should be spelled so that they are as close together as possible on the line of fifths, is "the most important" TPR and that "in many cases, this rule is sufficient to ensure the correct spelling of passages" (Temperley 2001, p. 125). TPR 2 is designed to account [End Page 54] for the way that notes are typically spelled in chromatic scale segments. TPR 3 states that the system should "prefer TPC representations which result in good harmonic representations" (Temperley 2001, p. 131). He formally defines the concept of a "good harmonic representation" in the first rule in his theory of harmony, HPR 1 (Temperley 2001, p. 149), which states that, in choosing the roots for chords, certain specified TPC-root relationships should be preferred over others. His theories of pitch spelling and...