skip to main content
research-article

Functional modelling of musical harmony: an experience report

Published:19 September 2011Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

_talk2.mp4

References

  1. E. Brady. Idris - systems programming meets full dependent yypes. In PLPV'11, pages 43--54, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. M. T. Chakravarty, G. C. Ditu, and R. Leshchinskiy. Instant generics: Fast and easy, 2009. Draft version.Google ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Stephen Downie. Music information retrieval. Annual Review of Information Science and Technology, 37 (1): 295--340, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  5. 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 ScholarGoogle Scholar
  6. E. Lempsink, S. Leather, and A. Löh. Type-safe diff for families of datatypes. In WGP'09, pages 61--72. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. F. Lerdahl and R. Jackendoff. A Generative Theory of Tonal Music. The MIT Press, 1983. ISBN 0-262-62107-X.Google ScholarGoogle Scholar
  8. 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 ScholarGoogle Scholar
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. C. D. Manning, P. Raghavan, and H. Schütze. Introduction to Information Retrieval. Cambridge University Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. F. Mountford. The musical scales of Plato's Republic. The Classical Quarterly, 17 (3/4): 125--136, 1923.Google ScholarGoogle ScholarCross RefCross Ref
  12. U. Norell. Dependently typed programming in agda. In AFP'08, volume 5832 of LNCS, pages 230--266. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. W. Piston and M. DeVoto. Harmony. Victor Gollancz, 1991.Google ScholarGoogle Scholar
  15. H. Riemann. Vereinfachte Harmonielehre; oder, die Lehre von den tonalen Funktionen der Akkorde. Augener, 1893.Google ScholarGoogle Scholar
  16. 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 ScholarGoogle Scholar
  17. M. Rohrmeier. Towards a generative syntax of tonal harmony. Journal of Mathematics and Music, 5 (1): 35--53, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. J. Steedman. A generative grammar for jazz chord sequences. Music Perception, 2 (1): 52--77, 1984.Google ScholarGoogle Scholar
  20. S. Doaitse Swierstra. Combinator Parsing: A Short Tutorial, pages 252--300. Springer-Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Functional modelling of musical harmony: an experience report

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 46, Issue 9
        ICFP '11
        September 2011
        456 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2034574
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
          September 2011
          470 pages
          ISBN:9781450308656
          DOI:10.1145/2034773

        Copyright © 2011 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 September 2011

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!