Abstract

Music theory has been essential in composing and performing music for centuries. Within Western tonal music, from the early Baroque on to modern-day jazz and pop music, the function of chords within a chord sequence can be explained by harmony theory. Although Western tonal harmony theory is a thoroughly studied area, formalising this theory is a hard problem.
We present a formalisation of the rules of tonal harmony as a Haskell (generalized) algebraic datatype. Given a sequence of chord labels, the harmonic function of a chord in its tonal context is automatically derived. For this, we use several advanced functional programming techniques, such as type-level computations, datatype-generic programming, and error-correcting parsers. As a detailed example, we show how our model can be used to improve content-based retrieval of jazz songs.
We explain why Haskell is the perfect match for these tasks, and compare our implementation to an earlier solution in Java. We also point out shortcomings of the language and libraries that limit our work, and discuss future developments which may ameliorate our solution.
Supplemental Material
- E. Brady. Idris - systems programming meets full dependent yypes. In PLPV'11, pages 43--54, 2011. Google Scholar
Digital Library
- M. M. T. Chakravarty, G. C. Ditu, and R. Leshchinskiy. Instant generics: Fast and easy, 2009. Draft version.Google Scholar
- D. Devriese and F. Piessens. Explicitly recursive grammar combinators - a better model for shallow parser DSLs. In PADL'11, pages 84--98. Springer, 2011. Google Scholar
Digital Library
- J. Stephen Downie. Music information retrieval. Annual Review of Information Science and Technology, 37 (1): 295--340, 2003.Google Scholar
Cross Ref
- W. B. de Haas, M. Rohrmeier, R. C. Veltkamp, and F. Wiering. Modeling harmonic similarity using a generative grammar of tonal harmony. In Proceedings of the Tenth International Conference on Music Information Retrieval (ISMIR'09), pages 549--554, 2009.Google Scholar
- E. Lempsink, S. Leather, and A. Löh. Type-safe diff for families of datatypes. In WGP'09, pages 61--72. ACM, 2009. Google Scholar
Digital Library
- F. Lerdahl and R. Jackendoff. A Generative Theory of Tonal Music. The MIT Press, 1983. ISBN 0-262-62107-X.Google Scholar
- J. P. Magalhães and J. Jeuring. Generic programming for indexed datatypes. Technical Report UU-CS-2011-021, Department of Information and Computing Sciences, Utrecht University, 2011.Google Scholar
- J. P. Magalhães, S. Holdermans, J. Jeuring, and A. Löh. Optimizing generics is easy! In PEPM'10, pages 33--42. ACM, 2010. Google Scholar
Digital Library
- C. D. Manning, P. Raghavan, and H. Schütze. Introduction to Information Retrieval. Cambridge University Press, 2008. Google Scholar
Digital Library
- J. F. Mountford. The musical scales of Plato's Republic. The Classical Quarterly, 17 (3/4): 125--136, 1923.Google Scholar
Cross Ref
- U. Norell. Dependently typed programming in agda. In AFP'08, volume 5832 of LNCS, pages 230--266. Springer, 2009. Google Scholar
Digital Library
- S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In ICFP'06, pages 50--61. ACM, 2006. Google Scholar
Digital Library
- W. Piston and M. DeVoto. Harmony. Victor Gollancz, 1991.Google Scholar
- H. Riemann. Vereinfachte Harmonielehre; oder, die Lehre von den tonalen Funktionen der Akkorde. Augener, 1893.Google Scholar
- M. Rohrmeier. A generative grammar approach to diatonic harmonic structure. In Proceedings of the 4th Sound and Music Computing Conference, pages 97--100, 2007.Google Scholar
- M. Rohrmeier. Towards a generative syntax of tonal harmony. Journal of Mathematics and Music, 5 (1): 35--53, 2011.Google Scholar
Cross Ref
- R. Schrijvers, S. Peyton Jones, M. M. T. Chakravarty, and M. Sulzmann. Type checking with open type functions. In ICFP'08, pages 51--62. ACM, 2008. Google Scholar
Digital Library
- M. J. Steedman. A generative grammar for jazz chord sequences. Music Perception, 2 (1): 52--77, 1984.Google Scholar
- S. Doaitse Swierstra. Combinator Parsing: A Short Tutorial, pages 252--300. Springer-Verlag, 2009. Google Scholar
Digital Library
Index Terms
Functional modelling of musical harmony: an experience report
Recommendations
Functional modelling of musical harmony: an experience report
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingMusic theory has been essential in composing and performing music for centuries. Within Western tonal music, from the early Baroque on to modern-day jazz and pop music, the function of chords within a chord sequence can be explained by harmony theory. ...
Functional generation of harmony and melody
FARM '14: Proceedings of the 2nd ACM SIGPLAN international workshop on Functional art, music, modeling & designWe present FComp, a system for automatic generation of harmony and accompanying melody. Building on previous work on functional modelling of musical harmony, FComp first creates a foundational harmony by generating random (but user-guided) values of a ...
Functional harmony ontology: Musical harmony analysis with Description Logics
AbstractSymbolic representations of music are emerging as an important data domain both for the music industry and for computer science research, aiding in the organization of large collections of music and facilitating the development of ...







Comments