[Stk] Ruby extensions with STK

Stephen Sinclair sinclair at music.mcgill.ca
Wed, 05 Dec 2007 14:41:29 -0500


> Well I only have very preliminary results, but for a single sinusoid 
> on a Core 2 Duo (Mac) I was getting about 1.9% - 2.0% CPU usage from 
> Ruby. Comparatively, running crtsine.cpp natively compiled, I got 1.8% 
> CPU 

cool.

> So the reason that interpreted languages are not good at realtime 
> synthesis seems to be that they are too slow to do the timely float 
> calculations of realtime audio (handling streams and whatnot) - but if 
> you offload the audio engine to C/C++ code, you should be able to get 
> decent performance and get to use a nice high level language like Ruby 
> to orchestrate objects.  Correct?

Pretty much.  But I assumed that even if you offload the float 
calculations into C code, if Ruby/etc sits anywhere within the actual 
synthesis loop it would slow things down.
Seems like you're getting pretty good results though...
I also figured it might work for sinusoids and the like, but I assumed 
it wouldn't scale very well to more complex computation.
Keep us posted on what you're able to do with it!

> What would be really amazing would be a domain specific language for 
> the STK built off of Ruby for manipulating audio objects, but I have 
> yet to figure out how one would manage audio streams between Ruby 
> objects...
Heh, well actually I think this is pretty much what Chuck is, minus the 
Ruby...  :-)


Steve