Adding PortAudio Support to HfM (Haskell for Mac)

Haskell for Mac is a pretty awesome IDE for the Haskell language with builtin graphics support but lacks any audio support. So I did some research and came up with the following recipe to add audio to your HfM programs.

First, install PortAudio using homebrew:

$ brew install portaudio

Next, download portaudio-0.2.4.tar.gz and unpack somewhere.

Open a command prompt and cd into the above directory and type the following:

$ cabal install ./ — verbose

Now load all of the files from the examples/ directory into HfM. Click on Example1.hs and change the module name to whatever it needs to be to match where you placed them in your project.

Next add /usr/local/opt/portaudio/lib as a data bucket using the top left hand dropdown.

You might have to restart HfM now.

Now, you should be able to type main into the playground of Example1.hs and you should hear a sound. Bravo!