[CM] [newbie] Is CLM the right tool for me?
bil at ccrma.Stanford.EDU
Fri May 1 03:34:23 PDT 2009
> would it be possible to have a way to convert a
> (define-instrument ...) into .C source code string?
If you look at the benchmarks in README.clm, you can see that
the translation to C only speeds up with-sound by (at best) a
factor of 2 or 3; in some cases, there's nothing to choose
between them. Given with-threaded-sound, you can immediately
get a factor of 2 or 4 from Scheme, so I think the two versions
are already comparable. Also, it's very misleading to say that
you can take the C code, plug it into sndlib, and run a note
list or whatever; if you look at run.lisp, you'll see that
much of the code is predigesting the instrument parameters
and whatever the outer "let" produces into something that
the C side can handle. Your FFI would either have to
handle hundreds of arguments, or use the opaque and hard to debug
parallel arrays that CL-CLM uses. Once you have that C code,
you have an astronomical maintenance and debugging burden.
You'd spend far more time fussing with your instrument in C
than you could ever spend waiting for with-sound in Scheme.
I think a better path would be to try to improve the Scheme
run macro; it could probably be sped up, and it certainly
could be extended to handle more of Scheme. I have always
felt that the CL/CLM C translation was a horrible disaster,
forced on me by the inadequate Lisps and FFI's of the late 80's,
and that if I were to do the CL side again, I'd simply
use sndlib's run.c.
More information about the Cmdist