On Thursday 21 May 2009, michael.gogins@gmail.com wrote: > If Csound is a bottleneck, may I ask if you are rendering in real-time, or > off-line? Offline. I usually generate a *lot* of notes. I've sometimes created some very dense clusters of notes with FM, using the "notes" to create varying modulation indexes. This case sound like a single note event, even tho Csound sees many different events. Other times, I've created rich sounds by using some of the more intensive Csound tools, like the phase vocoder. When I use GHC, the Haskell code runs so fast that I don't notice the time it takes. Of course, the compile time is noticable, but still very short, and often shorter than the Csound runtime. When I use Hugs, the runtime is much longer, so I mainly use that for writing very short musical fragments. I can then move them into the main composition which is compiled. Even with Hugs and very simple Csound instruments, the Hugs runtime is barely noticable. Here's Hudak's Waterfall example as a benchmark. Rendering Waterfall.sco with Hugs gives: real 0m1.272s user 0m1.168s sys 0m0.068s Rendering Waterfall.wav gives: real 0m0.718s user 0m0.628s sys 0m0.040s So this example is very generous to Csound. ;) However, I can make Csound work much harder than this: phase r pan = repeatM (Tempo (20%r) (mapPan pan waterfallScore)) phases = phase 18 0.2 :=: phase 19 0.8 :=: phase 17 0.4 :=: phase 16 0.6 len = dur waterfall phasingScore = cut (len * 8) phases Now the time for Hugs is more like this: real 0m16.580s user 0m16.341s sys 0m0.072s And for Csound: real 0m12.730s user 0m12.193s sys 0m0.112s Here's the result: http://members.lycos.co.uk/nerdware/csound/PhasingWaterfall.mp3 The instrument was one of the FM examples from the Csound book, plus reverb using the freeverb opcode. Nothing special, but sufficiently demanding to make the Csound runtime nearly match that of Hugs. This was one of my early uses of Haskore and Csound (nearly 3 years ago!), so it was rather simple. I'd definitely use GHC for this today. That would reduce the score-rendering time significantly. It would essentially be the compile time for the score file, and that would be something like this: real 0m1.159s user 0m0.868s sys 0m0.212s So even a trivial example like this can make Csound run an order of magnitude longer than the score rendering. By breaking a composition up into modules and/or extending the length of the score, I can make the difference far larger. I can also make the music more interesting, or at least try to. ;) -- Martin Rodgers http://www.wildcard.demon.co.uk