Cnoidal is a Haskell library for representing, transforming, and live coding music.
The library is based on the notion of temporal media, a data type that represents a collection of time intervals tagged with values. It supports various functor instances, like Applicative Functor, which are highly useful for live coding.
The name is inspired by the cnoidal waveform, a nondispersive shape that water waves can take.
A first version of the library was presented at the FARM 2019 workshop at the ICFP 2019 in Berlin. This presentation focuses on the temporal media data type, which represents music as a collection of time intervals tagged with values. It supports an Applicative Functor instance which is highly useful for live coding. However, a lawful Monad instance can only be defined for some variants of the data type. After introducing these functor instance, I gave a hands-on demonstration and live coded some music.
- Paper: Demo: Functors and Music [pdf]
- Video: Heinrich Apfelmus: Functors and Music [YouTube]
- Slides: slides-functors-and-music.pdf [pdf]
- Performance: One of a kind, never to be repeated. But here is a very similar worksheet that I created in preparation for the performance: not-the-performance.hhs [HyperHaskell worksheet]
By itself, the Cnoidal.Player
module only allows you to output MIDI messages. You will need a MIDI instrument to actually hear sound. However, you can find many software instruments on the internet. On the open source side, you can use
- fluidsynth — a synthesizer that uses Soundfonts.
- csound-expression — a Haskell library that wraps the Csound language.
On the commercial side, you can use most digital audio workstations (DAW) or a performance-oriented application like MainStage.