Last modified: Sep 7, 2017 @ 3:11 am

Getting Started

Once you have Euterpea and possibly HSoM installed, it’s a good idea to try some really simple things first. If you have any trouble with these, please take a look at the troubleshooting section at the bottom of the download and installation page.

Play Some Notes

  • Mac/Linux users: open your synthesizer! It must be running first to hear sound from Euterpea.
  • Open a command prompt or terminal and run ghci to start the Haskell interpreter.
  • Run import Euterpea and wait for all of the modules to load.
  • Run play $ c 4 qn and listen. You should hear a single tone.
  • Want more notes? Try this:
    play $ line [c 4 qn, c 4 qn, g 4 qn, g 4 qn, a 4 qn, a 4 qn, g 4 hn]
    Recognize the melody?

Notes from a Musical GUI (Requires the HSoM Library)

  • Open a command prompt or terminal and start ghci as above. Mac/Linux users: make sure your synthesizer is open!
  • Run import HSoM.Examples.MUIExamples2 and wait for all of the modules to load.
  • Run bifurcate and wait for a window to pop up (it can take a few seconds to load fully). You should see a bunch of sliders an text fields with changing values, and you should hear notes periodically.
  • Move the sliders to hear some crazy stuff.


A collection of supplemental code examples is available on GitHub. These are different from the examples covered in the Haskell School of Music textbook. Download the examples 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.

Euterpea 2 Examples

The following supplemental examples can be downloaded from GitHub. Please note that these examples are not meant to fully 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.
    • BlueLambda – some interesting music in just four lines of code along with an example of a custom playback function.
  • 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.
    • Interactive Stochastic Music (MIDI input required) – a Haskell port of a JythonMusic program for interactive music generation. Input from a MIDI controller is taken in real-time and used to generate new sequences.


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.

Haskell Tutorials

The Haskell School of Music textbook offers a simultaneous introduction to the Haskell programming language and the Euterpea library. However, that’s not the only way to learn the language and library. You can follow some other online Haskell tutorials to familiarize yourself with the basic syntax of the language, then 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.