Send and receive MIDI messages


hmidi: Haskell bindings to the OS level MIDI services

Partial implementation of the MIDI 1.0 standard to communicate with physical or virtual MIDI devices, eg. MIDI keyboards and synthesizers.

Supported operating systems are MacOS and Windows. See also the alsa-midi library for similar functionality under Linux.

Installation & Usage

It should install with cabal without problems on Mac OS X and Windows. Linux is not supported.

As usual, just run the command:

cabal install 

When using the library, you have to link against the threaded runtime (otherwise random crashes will occur); for example:

ghc --make -threaded -O monitor.hs

Example applications

There are some example command line applications in the examples subdirectory:

  • monitor.hs - very basic MIDI monitor
  • chords.hs - convert NoteOn messages to simple chords
  • playmidi.hs - play simple .mid files on General MIDI compatible synths
  • osx_host.hs - create a MIDI host (as opposed to connecting to existing host). Only works on MacOs.

You can build them with ghc --make -threaded like above.

Differences between Windows and MacOS

We tried to create a unified Haskell API, but there are still differences between the Windows and Mac implementations. In particular, you cannot create MIDI hosts on Windows.