English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Could be Caml a good language for sound manipulation ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-29 (03:21)
From: Julian Brown <brown@c...>
Subject: Re: Could be Caml a good language for sound manipulation ?
On 2004-11-28, Elthariel <elthariel@free.fr> wrote:
> Hello "les Cémaliens",
> I'm quite new in oCaml world, I partially learnt it in my school (EPITA 
> / Paris) and I'm going to finish this next year. I'm not really ease in 
> english so my question will be short : do you think Caml coul be a nice 
> langage for sound manipulation implementation, as Synthetizers, effects 
> plugins ? I doesn't ask for answer in term of performance which should 
> be I guess quite good :p, but more in term of software design and 
> language facility.

I can't really answer this very sensibly with my extremely limited
experience in the area, but I will try anyway!

I think that performance problems may hit you sooner than you might hope
for real-time stuff. I was slightly surprised that my naive first attempt
at audio-type programming with Ocaml failed to fill buffers fast enough
with a bytecode-compiled executable, though native code is fine (this
was on a 1GHz Athlon, YMMV). The trancendental functions and non-tail
recursive functions I used might have something to do with it though.

As for the manipulation of sound itself, yes, Ocaml is a lovely
language! It may be better to stick with an imperative rather than
functional programming style though, for reasons of performance. Also,
under Linux, the low-level ioctl calls are a total pain, and require
interfacing to C.

You can have a look at this as an example if you like, though I don't
expect it will be very useful to you:


It needs lablgtk2, and probably won't work on anything but Linux. It's
only been tested on x86. The sound.ml/sountctl.c files might be a useful
starting point for some sort of sound output library, if you can't find
anything else more suitable.