Music scholars have been studying tonal harmony intensively for centuries, yielding numerous theories and models. Unfortunately, a large number of these theories are formulated in a rather informal fashion and lack mathematical precision. In this article we present HarmTrace, a functional model of Western tonal harmony that builds on well-known theories of tonal harmony. In contrast to other approaches that remain purely theoretical, we present an implemented system that is evaluated empirically. Given a sequence of symbolic chord labels, HarmTrace automatically derives the harmonic relations between chords. For this, we use advanced functional programming techniques that are uniquely available in the Haskell programming language. We show that our system is fast, easy to modify and maintain, robust against noisy data, and that its harmonic analyses comply with Western tonal harmony theory.For ages, musicians, composers, and musicologists have proposed theories regarding the structure of music to better understand how it is perceived, performed, and appreciated. In particular, tonal harmony exhibits a considerable amount of structure and regularity. The first theories describing tonal harmony date back at least to the 18th century (Rameau 1722). Since then, a rich body of literature that aims at explaining the harmonic regularities in both informal and formal models has emerged (e.g., Lerdahl and Jackendoff 1996). Such models have attracted numerous computer music researchers to investigate the automation of the analysis and generation of harmony. Most of these theories, however, have proven to be very hard to implement (e.g., Clarke 1986). We are not aware of a model that has a working implementation that effectively analyzes tonal harmony and deals robustly with noisy data, while remaining simple and easy to maintain, and scaling well to handle musical corpora of considerable size. In this article we present HarmTrace (Harmony Analysis and Retrieval of Music