Describing and Interpreting Music in Haskell


Paul Hudak


Musicologists have long noted subtle and complex relationships between musical compositions and mathematical structures.  Indeed, some well

known composers deliberately exploited this relationship in their compositions.  In this chapter we explore a slightly different relationship: that between musical expression and computer languages.  Specifically, we accomplish two things.

First, we use Haskell to describe musical structures.  These structures consist of primitive entities (notes and rests), operations to transform musical
structures (transpose and tempo-scaling), and operations to combine musical
structures to form more complex ones (concurrent and sequential composition).  From these simple roots, much richer musical ideas can be developed.

Second, we define an interpretation of these musical structures in terms
of an abstract notion of performance.  This interpretation gives meaning to
our music (even if not as grandiose as the meaning given by professional
musicians), which allows us to prove certain laws that collectively form an
algebra of music.


    ,author={Paul Hudak}
    ,title={Describing and Interpreting Music in {H}askell}
    ,booktitle={The Fun of Programming}
    ,editors={Jeremy Gibbons and Oege de Moor}