| Perhaps I was too hasty, but it wasn't clear to me that your context was
composition, not rendering.
For composition, I myself use C++ classes (CsoundAC) written by me, from
Python using SWIG-generated interfaces. These interfaces allow me to
subclass the C++ base classes in Python. I actually do my composing in
Python. I imagine the experience would be comparable in Lisp or Scheme.
For the stuff I do, the score generating runtime can in fact be significant,
and having things like voice-leading routines in C++ is a definite benefit.
If Csound is a bottleneck, may I ask if you are rendering in real-time, or
off-line?
If off-line, you might consider writing your rendering code directly in C++
using the STK or some similar class library. Experiments I have done along
these lines show modest improvements.
Regards,
Mike
----- Original Message -----
From: "Martin Rodgers"
To:
Sent: Wednesday, May 20, 2009 6:13 PM
Subject: [Csnd] Re: Re: Re: Re: Haskell for computer music
> On Wednesday 20 May 2009, Michael Gogins wrote:
>> In the real world, this is more important than the elegance of
>> functional programming.
>
> In the music world, elegance of notation helps composers.
>
> All my music code written in Haskell runs so fast that I don't have to
> wait.
> This is not a computationally demanding domain. Csound takes far longer to
> run
> by many orders of magnitude. However, if my code needed to do more work,
> and
> was less concerned with musically structure, then I'd start by compiling
> it
> and then look at more aggressive ways to improve the performance.
>
> I've long been amazed at how many people dismiss languages without even
> considering the use of a compiler. My first code to make sounds was
> written in
> Basic, but I had no compiler for it at that time. My next code was written
> in
> Forth, for which I had several compilers (one of which I wrote myself, but
> that's another story). I've yet to write any music-related code in C/C++,
> but
> as I'm using Csound to make the audio, generating the score in C/C++ would
> be
> overkill for my modest needs. It already takes less than a second to
> generate
> a score that takes Csound minutes to render. How will improving the
> performance of my score-generating code help me? Will C/C++ improve the
> quality of the notation for my music? That's unlikely, given the high
> standard
> set by Haskore.
>
> So for now, I'm content to write my code in languages like Haskell,
> Scheme,
> and Common Lisp. On the rare occaision when the runtime is poor and I
> can't
> improve it any more by tweaking the code, I identify the bottleneck and
> rewrite that one bit of code in C. The last time I had to do that was in
> the
> mid-90s, and that was some HTML-parsing code. The one of the two C
> functions I
> wrote skipped whitespace and the other collected text until it hit a
> delimiter. With the compilers I use today, I doubt I'd need to do that
> now.
>
> As I said above, Csound itself is the performance bottleneck for me, and
> that's already written in C. AFAICT the C code is very well optimised. By
> that
> I mean that the optimisations have been performed on the source code
> before
> the compiler even reads it. (There's an old joke that the C language
> employs a
> highly sophisticated optimiser called a C programmer.)
>
> However, if/when you find that the Csound runtime is close to or less than
> the
> runtime of your score-generating code, then by all means use whatever
> measures
> you see fit to improve the performance of the latter. :-)
> --
> Martin Rodgers http://www.wildcard.demon.co.uk
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
|