Euterpea Homepage

Information about the Euterpea and HSoM Libraries for making music with Haskell.

Euterpea: a Haskell Library for Music Creation

Euterpea is a cross-platform, domain-specific language for computer music applications embedded in the Haskell programming language. Euterpea is a wide-spectrum language, suitable for high-level music representation, algorithmic composition, music analysis, working with MIDI, low-level audio processing, sound synthesis, and virtual instrument design.

Site Navigation

About Euterpea

Euterpea is a domain-specific language, embedded in the functional language Haskell, for computer music composition and development. The name Euterpea is derived from Euterpe, who was one of the nine Greek Muses (goddesses of the arts), specifically the Muse of Music.

Euterpea is a descendant of Haskore and HasSound, and is intended for both educational purposes as well as serious computer music applications. Euterpea is a wide-spectrum language, suitable for high-level music representation, algorithmic composition, and analysis; mid-level concepts such as MIDI; and low-level audio processing, sound synthesis, and instrument design.

Library Compatibility

If you already have GHC but it’s outside any of the ranges listed above, Euterpea may still work – give it a try before installing a different version.

Getting Started with Euterpea

Here’s what you need to do to install Euterpea for the first time and play your first note in four general steps: installing Haskell, installing Euterpea, setting up a synthesizer, and installing HSoM.

Step 1: Install Haskell

Install Haskell for your operating system. Ideally use one of the GHC versions listed at the top of the page. Each OS category has its own caveats either before or after installation:

Mac: you may need to install or update xcode first if you get cryptic install errors. Windows: check your default installed GHC version if using ghcup! You may need to manually downgrade to 8.10.5 to avoid installation errors (using “ghcup install ghc 8.10.5”). Linux: you must install ALSA (ex: sudo apt-get install libasound2-dev)

Step 2: Install Euterpea

Download or clone the Euterpea2 repository on GitHub. If downloading as a ZIP file, unzip it. Open a command prompt (Windows) or terminal (Mac/Linux) and cd into the repository folder where the euterpea.cabal file is located. Run the following commands:

cabal update
cabal v1-install --allow-newer

Older ghc/cabal version users: if you run into weird errors about finding compatible package versions, try using cabal v1-update instead and then re-running the install command.

If you can’t get Euterpea to install with the commands listed here, check the troubleshooting page.

Step 3: Setup a Synth and Test Euterpea

Mac/Linux users: install a MIDI software synthesizer, such as VMPK, SimpleSynth, or Fluidsynth. Make sure it’s running before you start Euterpea in GHCi. With VMPK for Mac, make sure “omni” is enabled and that it’s using CoreMidi (not Network).

Windows users: typically Windows will already have a generic MIDI synth installed and you can simply move on to testing Euterpea with GHCi. If you don’t have the Windows GM synth for whatever reason, you can try Coolsoft’s VirtualMIDISynth. Make sure to have it running with instruments loaded before starting GHCi.

Open a new command prompt, powershell, or terminal. Important: do not simply start ghci from within the euterpea repository folder where you performed the installation! If you attempt to import Euterpea from the folder containing etuerpea.cabal, you’ll get errors.

Run the following commands:

ghci
import Euterpea
play $ c 4 qn

You should hear a note play if your synth is configured correctly. If you don’t, check the Setting Up MIDI and/or Troubleshooting pages.

Step 4: Install HSoM (Optional)

If you also want HSoM, which is the companion library for the Haskell School of Music textbook, you can install it similarly to Euterpea. Download/clone the the HSoM repository on GitHub, cd into the repository folder (where hsom.cabal is), and run the cabal v1-install command as you did for Euterpea.

Mac users: to use HSoM’s musical user interfaces (MUIs), you must compile to executable rather than using the interpreter. There’s an example of how to do this on the Compiling to Executable page.

Now you’re ready to head to the Tutorials and Examples pages to learn about how to use Euterpea and try out some existing code. Once you’re ready to start building your own programs with Euterpea, head to the API Documentation for more information on Euterpea’s features.

Having installation trouble or don’t hear any sound?

Check out the Troubleshooting page for a list of solutions for common problems organized by OS and category. For sound-related problems, you can also check out the Setting up MIDI page.

Looking for a text editor to use with Haskell & Euterpea? Here are some suggestions:

Or check out this extensive list of editor options: [https://wiki.haskell.org/Editors]

Questions/Comments

Please send questions and comments related to Euterpea to Donya Quick (donyaquick@gmail.com) but please read the FAQ below first to see if your question is answered there first! Donya Quick is the current maintainer of the Euterpea and HSoM libraries.

FAQ