Last modified: Jan 3, 2017 @ 2:21 pm

A collection of supplemental code examples is now available on GitHub. These are different from the examples covered in the Haskell School of Music textbook. If you are looking to get started with Euterpea and don’t have the textbook, download the GitHub examples described here and try editing them to explore how the changes affect what you hear – experimentation is one of the best ways to learn a new library! You can also check out the Examples folder of the HSoM library, which contains all of the code examples from the textbook, but without the accompanying descriptions.

If you are completely new to Haskell, it is recommended that you use the Haskell School of Music textbook as a simultaneous introduction to Haskell and Euterpea. Alternatively, you can follow some other online Haskell tutorials to familiarize yourself with the basic syntax of the language, take a look at the Euterpea API pages, and browse through the code in the Euterpea library itself (all of which is open source). Some useful online tutorials are linked to below, followed by links to extra Euterpea examples not included in the textbook and, finally, examples of other, larger applications that make use of Euterpea and HSoM.

Haskell Tutorials

If you are completely new to Haskell, you may find it useful to look at some of these pages first before trying to use Euterpea.

Euterpea 2 Examples

The following supplemental examples can be downloaded from GitHub. Please note that these examples are not meant to replace the textbook or other basic tutorials on the Haskell programming language as a means of learning Haskell and Euterpea.

  • Note-level examples: making music with MIDI.
    • SimpleMusic – examples of basic usage of Euterpea’s Music data type.
    • RandomMusic – shows how to make sequences of random numbers and interpret them musically.
  • Signal-level examples: generating sound as WAV files.
    • SineWaves – generating a sine wave and making two simple instruments with sine waves.
    • Bell – constructing a bell instrument with Euterpea’s signal processing framework.
  • Musical User Interface (MUI) Examples: interactive MIDI programs.
    • SimpleGUIs – examples of using UISF widgets, which are the foundation of HSoM’s MUIs. Many of these do not produce sound and just illustrate the usage of individual graphical widgets in a simple setting.
    • DrumMUI – a small drum machine MUI that allows the user to select one of several patterns to play and the tempo.


Larger Programs

  • HaskellOx – a program that routs MIDI messages between devices and demonstrates two methods for implementing this functionality. The linked zip file includes both the source and a compiled executable for Windows. See the batch file for the best compilation method.