Hi, as a beginner I have a beginner's question: Which is the most simple way > to make my haskell programm play a sound? >
It really depends what kind of sound you want to make. Play a beep, or a .wav file, or a waveform generated by your program, or just play a piano-like sound, etc...? On windows, you can play back any kind of sound with DirectSound (that may be too complicated for your goals, or maybe exactly the right thing): http://code.haskell.org/~bkomuves/projects/DirectSound/ The OSX analogue of this is CoreAudio. http://code.haskell.org/~bkomuves/projects/macosx-core/ There are examples how to play back a simple waveform with these at http://code.haskell.org/~bkomuves/projects/examples/DirectSound_playback_example.hs http://code.haskell.org/~bkomuves/projects/examples/CoreAudio_playback_example.hs One of the Linux analogues (sound on Linux is complicated...) is ALSA: http://hackage.haskell.org/package/alsa There is the crossplatform solution OpenAL, however, in my personal opinion it is unsuitable for streaming sound, and causes more problems than it solves; however, it may be the easiest solution for simple playback of samples: http://hackage.haskell.org/package/OpenAL Another crossplatform solution is PortAudio; I have no experience with it. http://hackage.haskell.org/package/portaudio If you want just to play back a .WAV sample on Windows, there is the PlaySound function in the Win32 API, which makes this trivial; it is very easy to call this using the Haskell FFI. http://msdn.microsoft.com/en-us/library/dd743680(VS.85).aspx There is the Sox library http://hackage.haskell.org/package/sox. You drive the operating system's MIDI synth via MIDI, that again differs on different operating systems... etc etc. > > (I was hoping that there was a Windows&Linux library with a simple > command to play a note for a given time or some other simple solution > for simple sound production). > Unfortunately we are not there yet :) ps. There is also a section on the Haskell wiki: http://haskell.org/haskellwiki/Category:Music Balazs
_______________________________________________ haskell-art mailing list [email protected] http://lists.lurk.org/mailman/listinfo/haskell-art
