On Fri, 13 Apr 2001, akhar wrote:
> Can ruby record/play sounds on multiple platforms?
I don't know about other platforms, but I created a package for sound
output on <linux/soundcard.h>-compatible systems. It's not even one page
long and you could add input support (and support for more options) quite
trivially. (And I could even do that for you)
However I don't know at all about sound support on other platforms.
> but not much is said on the sites I've seen where can I get more info on
> streaming? UDP and TCP?
There is support for UDP and TCP as a plugin bundled with ruby itself. For
particular streaming algorithms you'll have to figure those out yourself
-- it can be as simple as just TCP or UDP, or adding "sliding redundancy"
so that the sound doesn't cut when a few packets are dropped, etc.; you
may have a particular existing protocol in mind, in which case i can't be
of any help to you.
> Can I compile Ruby code for easy distribution?
There is a ruby compiler that sort-of works (similar to what can be done
with Perl). There is also a simple way to repackage an interpreter with
predefined source: you convert that source to big C strings and you
compile a one-page program that you link with "libruby" and all those
strings. I think there is already a program that can generate that for
you, and it's probably only a few pages too.
> how fast is Ruby?
Calling a method by its name (the usual method-calling) is faster in Ruby
than in Perl. In general Perl, Ruby, Python are of very comparable speeds
though each of those have a slight bias towards certain operations.
If you need to do faster processing, then you can plug in C code very
easily compared to Python/Perl.
If you're only doing numerical processing though, then it's very probably
that all you need is probably best done using NArray, which gives me the
speed of APL or C (at least when my arrays are large enough). I began
writing a sound synthesiser and it was going quite well with NArray.
matju