skip to main content
article

Well-typed music does not sound wrong (experience report)

Published:07 September 2017Publication History
Skip Abstract Section

Abstract

Music description and generation are popular use cases for Haskell, ranging from live coding libraries to automatic harmonisation systems. Some approaches use probabilistic methods, others build on the theory of Western music composition, but there has been little work done on checking the correctness of musical pieces in terms of voice leading, harmony, and structure. Haskell's recent additions to the type-system now enable us to perform such analysis statically.

We present our experience of implementing a type-level model of classical music and an accompanying EDSL which enforce the rules of classical music at compile-time, turning composition mistakes into compiler errors. Along the way, we discuss the strengths and limitations of doing this in Haskell and demonstrate that the type system of the language is fully capable of expressing non-trivial and practical logic specific to a particular domain.

References

  1. Lennart Augustsson and Mårten Ågren. 2016. Experience report: Types for a relational algebra library. In Proceedings of the 9th International Symposium on Haskell. ACM, 127–132. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. W. Bas de Haas, José Pedro Magalhães, Frans Wiering, and Remco C. Veltkamp. 2013. Automatic functional harmonic analysis. Computer Music Journal 37, 4 (2013), 37–53.Google ScholarGoogle ScholarCross RefCross Ref
  3. Richard A Eisenberg. 2016. Dependent Types in Haskell: Theory and Practice. Ph.D. Dissertation. University of Pennsylvania.Google ScholarGoogle Scholar
  4. Richard A. Eisenberg, Stephanie Weirich, and Hamidhasan G. Ahmed. 2016. Visible Type Application. In Proceedings of the 25th European Symposium on Programming Languages and Systems - Volume 9632. Springer-Verlag New York, Inc., New York, NY, USA, 229–254. DOI:Google ScholarGoogle Scholar
  5. Johann Joseph Fux. 1965. The study of counterpoint from Johann Joseph Fux’s Gradus ad Parnassum. Number 277. WW Norton & Company.Google ScholarGoogle Scholar
  6. Cheng Zhi Anna Huang and Elaine Chew. 2005. Palestrina Pal: a grammar checker for music compositions in the style of Palestrina. In Proceedings of the 5th Conference on Understanding and Creating Music. Citeseer.Google ScholarGoogle Scholar
  7. Paul Hudak, Tom Makucevich, Syam Gadde, and Bo Whong. 2008. Haskore music notation – An algebra of music. Journal of Functional Programming 6, 03 (Nov 2008), 465–484.Google ScholarGoogle Scholar
  8. Gerhard Nierhaus. 2009. Algorithmic Composition: Paradigms of Automated Music Generation. Vol. 1. Springer Verlag Wien. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Chris Okasaki. 2003. Theoretical pearls: Flattening combinators: Surviving without parentheses. Journal of Functional Programming 13, 4 (July 2003), 815– 822. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Martin Rohrmeier. 2011. Towards a generative syntax of tonal harmony. Journal of Mathematics and Music 5, 1 (2011), 35–53.Google ScholarGoogle ScholarCross RefCross Ref
  11. Alejandro Serrano and Jurriaan Hage. 2016. Type error diagnosis for embedded DSLs by two-Stage specialized type rules. In European Symposium on Programming Languages and Systems. Springer, 672–698.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Well-typed music does not sound wrong (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 52, Issue 10
        Haskell '17
        October 2017
        211 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3156695
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell 2017: Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell
          September 2017
          211 pages
          ISBN:9781450351829
          DOI:10.1145/3122955

        Copyright © 2017 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 7 September 2017

        Check for updates

        Qualifiers

        • 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!