Question

I'm toying around with constructing a basic music composition system for fun. I can represent music in memory, but I'd (obviously) like to be able to output actual sounds! I don't really care what the format is (MIDI, mp3, ogg, whatever). I just want to be able to load samples into the program and play them in the simplest way possible. I've searched around for a solution but everything I'm seeing is either a) too complex (overhead-wise) for my needs, b) not actively supported, or c) not well-documented. I would love to see an example of sound output or otherwise, some direction on the simplest way to do so.

Was it helpful?

Solution 2

I ended up using MIDI and sending events to SimpleSynth, on Mac OSX. This was achieved using the hmidi package and the bindings to OSX's CoreMIDI by bkomuves. I had to install a fork of the hmidi package from here to get it working with the latest GHC. I then installed SimpleSynth and enabled an IAC Driver using the Audio MIDI Setup utility on OSX. I then set SimpleSynth to listen from the IAC Driver I set up and was able to use the enumerateDestinations function from bkomuvres' bindings to CoreMIDI to grab the first available Destination and send MidiEvents from hmidi using send. It works like a charm!

OTHER TIPS

You might like Euterpea, which isn't on Hackage but was a breeze to install and has quite verbose documentation (it seems it forms the core of an introductory Haskell course at Yale). Hover over the word "Euterpea" in the menu at the top to find more links/instructions.

With Haskell, you may wish to get a handle on the language fully by utilising other libraries/applications from your code, however the following link is a link to libraries for music and sound.

http://www.haskell.org/haskellwiki/Applications_and_libraries/Music_and_sound

Another idea is to gain familiarity with OpenAL with C/C++ and then from there you will have some familiarity with the structure of HOpenAL (Haskell binding of OpenAL which indeed calls the OpenAL DLL/SO).

Link with straightforward tutorial for OpenAL ago! http://enigma-dev.org/forums/index.php?topic=730.0;wap2

I hope this helps...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top