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.
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- Richard A Eisenberg. 2016. Dependent Types in Haskell: Theory and Practice. Ph.D. Dissertation. University of Pennsylvania.Google Scholar
- 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 Scholar
- Johann Joseph Fux. 1965. The study of counterpoint from Johann Joseph Fux’s Gradus ad Parnassum. Number 277. WW Norton & Company.Google Scholar
- 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 Scholar
- 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 Scholar
- Gerhard Nierhaus. 2009. Algorithmic Composition: Paradigms of Automated Music Generation. Vol. 1. Springer Verlag Wien. Google Scholar
Digital Library
- Chris Okasaki. 2003. Theoretical pearls: Flattening combinators: Surviving without parentheses. Journal of Functional Programming 13, 4 (July 2003), 815– 822. DOI: Google Scholar
Digital Library
- Martin Rohrmeier. 2011. Towards a generative syntax of tonal harmony. Journal of Mathematics and Music 5, 1 (2011), 35–53.Google Scholar
Cross Ref
- 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 Scholar
Cross Ref
Index Terms
Well-typed music does not sound wrong (experience report)
Recommendations
Well-typed music does not sound wrong (experience report)
Haskell 2017: Proceedings of the 10th ACM SIGPLAN International Symposium on HaskellMusic 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 ...
Music similarity: improvements of edit-based algorithms by considering music theory
MIR '07: Proceedings of the international workshop on Workshop on multimedia information retrievalEstimating the symbolic music similarity is one of the major open problems in the music information retrieval research domain. Existing systems consider sequences of notes characterized by pitches and durations. Similarity estimation is mainly based on ...
Experience report: type-checking polymorphic units for astrophysics research in Haskell
Haskell '14: Proceedings of the 2014 ACM SIGPLAN symposium on HaskellMany of the bugs in scientific programs have their roots in mistreatment of physical dimensions, via erroneous expressions in the quantity calculus. Now that the type system in the Glasgow Haskell Compiler is rich enough to support type-level integers ...







Comments