The Temperley-Sleator Harmonic Analyzer

This page is obsolete. Please go to http://www.link.cs.cmu.edu/melisma/
for more recent information on this project.

We have written a program for analyzing music harmonically. The program begins with a piece represented as pitches; it divides the piece into segments, and labels each one with a chord. The program implements a procedure for harmonic analysis developed by David Temperley; the program itself was conceived and written by Daniel Sleator.

The program has two stages; the "tonal-pitch-class" stage and the harmonic stage. The tonal-pitch-class stage gives each note in the piece its appropriate label or spelling (i.e., Ab versus G#): this means mapping each note on to what we call the "line of fifths" (like the circle of fifths, except a line extending indefinitely in either direction). Its main criterion here is that it tries to label notes so that they are close together on the "line of fifths". The harmonic stage divides the piece into segments and labels them with roots. The program's criteria at this stage are several "preference rules". It tries to find an analysis of the piece such that a) the pitches in each segment are compatible with the chosen root; b) roots of nearby segments are close together on the line of fifths; c) chord-changes occur on metrically strong beats; and d) any ornamental dissonances (or non-chord-tones) are "good" ornamental dissonances, in that they are closely followed by another note a step away. The program finds the optimal analysis of the piece given these constraints.

As an illustration of what the program does, you can see the the note lists for Yankee Doodle and the Gavotte from Bach's French Suite No. 5, and the output produced by the program.

More details about the algorithm can be found in David Temperley's dissertation, "The Perception of Harmony and Tonality: An Algorithmic Approach" (Ph.D dissertation, Columbia University, 1996, available from University Microfilms). Temperley has also written a paper about the project which will be published soon. (You can request a copy of the paper by sending electronic mail.)

The program is publicly available (for non-commercial use), along with other files that may be of interest. These include input files of various pieces that we have tested on the program, as well as a file, documentation on compiling and running the program under unix. The program can be used to analyze MIDI files as well. (Metrical information must be added by hand.) Click here to enter this anonymous FTP directory. Click here to download the whole package at once. (If you use the latter method, then once you have the file "harmonic-analysis.tar.gz" issue the unix command "gunzip < harmonic-analysis.tar.gz | tar xf -"

If you have any comments about this work, or are using it for your own purposes, we would like to hear from you. You can send us electronic mail.

Davy Temperley
Daniel Sleator
October, 1996.