23 Feb 2009

In a paper I’ve just completed—Harmonic analysis of jazz chord sequences—I describe the T2 algorithm. This article explains some of the reasons I chose to work on this problem. There are (hopefully) also some insights into the state of computer music research and scientific research in general. Plus the question “is computer music more computer science or more music theory?”.

The Java ME clock I posted a few days ago was of course the result of a diversion. In the last few months I have in fact been writing up my work on T2 and harmonic analysis of jazz chord sequences. It took more time than expected because I went on a detour to make improvements to the algorithm, which resulted in version 2 of T2G. The good news is the algorithm is now easier to explain and works better than ever.

Well, I have finally completed my paper “Harmonic analysis of jazz chord sequences” and it now has its own permanent webpage. There you will also find links to download the source code of my OCaml implementation of the T2 algorithm and test data, which you can use to verify the results that are claimed in the paper. I will soon submit that paper for publication, which will symbolically mark the end of this project on harmonic analysis for me and let me move on to work on something else at least for the time being. That’s a wonderful feeling.

A few bits of information about this work may be of some interesting, but don’t seem quite suitable for the technical paper. So I’ll write them up here.

I’ve been interested in the harmonic analysis of chord sequences as far back as when I was working on MyJazzBand, my automatic accompaniment generator. The problem I faced then was to find a way to generate better bass lines than existing programs such as Band-in-a-Box and MiBAC JAZZ. So I came up with this quick-and-dirty “analysis algorithm”. It was just that: a more reasonable way of choosing what scales to play instead of making what seem to be random choices like other algorithms.

Soon after I found my algorithm cited in a thesis and a technical report and compared to other harmonic analysis algorithms (reason not to Google yourself :-)). Of course it didn’t compare favorably because that was not what it was designed to do! This told me two things: that research scientists are sometimes too eager to find previous works to critize, and more importantly, there’s a lot of room for improvements on solutions to this problem.

I had already looked for ready-made harmonic analysis algorithms before I devised my ad hoc one. More literature search after discovering the citation didn’t turned up any satisfactory solutions. This was *very surprising* because for a long time people have been building programs that attempt to simulate jazz improvisation while they have not solved this very fundamental problem! Perhaps it’s easier to get research grants for projects that generate “some music” rather than ones that, say, just analyze the harmonic structure of chord sequences.

Two additional clues suggested this problem required further work. Existing methods were all grammar-based or rule-based (e.g., ones suggested by F. Pachet et al. and ones by G. Ramalho et al.). These can all be traced back to a grammar for blues chord changes in this paper: M. Steedman, A Generative Grammar for Jazz Chord Sequences. *Music Perception* 2 (1) (1984) 52-77. While grammars and rule bases can work as generative models when one limits the scope of the language, they break down as analytical models for open-ended collections of chord sequences. To be fair, the author did not originally suggest that his grammar can be used for *parsing* chord sequences: it wasn’t given in such a way for which an efficient parser can be built anyway. However he fixed this problem in his more recent paper: M. Steedman, The Blues and the Abstract Truth. *Mental Models in Cognitive Science*. A. Garnham and J. Oakhill (eds.), Erlbaum, Mahwah, NJ, 1996.

It seemed logical to me, then, that we needed to move away from grammar-based and rule-based systems to build generalized harmonic analysis algorithms. Unfortunately a few recent works still go down that path, for example, see M. Wilding’s thesis, this SBCM paper, and this SMC paper. That’s why I feel that my paper needs to be published.

The other thing that was very curious to me was that none of these papers referenced any good jazz theory books! Think about that for a moment: can we really expect successful algorithms to be designed and built without a good understanding of the underlying principles of the problem domain? Actually the output generated by these systems reveal their “foreignness” in the realm of jazz theory too: that the analyses are typically represented by parse trees or an explanation of the application of rules. A more natural representation is of course a chord chart annotated with tonality centers and symbols for elements of jazz theory (such as dominant resolutions, ii-Vs, etc.), commonly used by musicians.

Prompted by this I spent a while studying very closely as many jazz theory books as I could. Andrew Jaffe’s *Jazz Theory*, Nettles and Graf’s *The Chord Scale Theory and Jazz Harmony*, Mark Levine’s *The Jazz Theory Book*, and others (full citations for these books can be found in my paper). That, apart from being a lot of fun, helped in generating many ideas and new problems (and the right problems!) to be solved.

The end result of this very different approach is now of course summarized in my paper. Download it, read it, play with the sample implementation, and generally have fun! Having worked on a solution for a problem for a while, one cannot help but become attached and think of it as superior to everything else around (but it is! :-)). If you can disregard that bit of ego for a moment though, perhaps you can find a few lessons in the account above. If they aren’t helpful to you in your search for or work on the next research project, let me hope at least they serve as background information which makes reading my paper a little more interesting.

Andrew Choi. Calgary.

Category: Jazz, T2