
On Sat, 2007-08-25 at 23:36 +0200, jerzy.karczmarczuk@info.unicaen.fr wrote:
Evan Laforge writes:
Indeed, you can write certain DSP algorithms beautifully in Haskell. Now, if only it could talk to the audio hardware... (Or just use common file formats even.)
Oh, that's easy. I wrote an FFI interface to portaudio a while back to write a delay-looping type utility in haskell. It was pretty trivial. You could do the same for libsndfile or whatever.
The only thing I'm uncertain about is whether it would have good enough time and space performance. All the real work is writing yet another set of basic envelope, oscillator, and fft primitives. You *should* be able to go all the way down to the samples in pure haskell though, which would be more elegant than those other languages :)
==
Well, if you want to see what you can do with a lazy functional language, not necessarily Haskell, but Clean (sorry for advertizing a competitor on this list...), perhaps have a look on my PADL paper
http://users.info.unicaen.fr/~karczma/arpap/cleasyn.pdf
I generated .wav files as output, from lazy streams, so the sound was off-line. My ambition was to code in a very, very compact way some musical instruments, with looping replaced by co-recursion. It cannot be extremely efficient, but it seems quite elegant and powerful.
Last week I did exactly that. Using lazy streams and a quickly hacked up .wav file output, I played with some of the extended Karplus-Strong plucked string/drum synthesis algorithms.