Re: [linux-audio-dev] Writing LADSPA plugins in high level language?

From: Steve <radarsat1@email-addr-hidden>
Date: Wed Jun 14 2006 - 16:59:48 EEST

I think this is a worthwhile topic actually...
There is currently a shortage of interest in developing good
alternative NATIVE machine-language-compiled languages.
Although I have been programming C/C++ for a long time, I have lately
been getting into Python and I really like it... Really, there's no
REAL reason we can't use other languages for writing audio stuff,
except that most newer languages tend to be designed for either
interpreters or bytecode machines.

The reason is straight-forward: Interpreters and virtual machines are
way easier to debug and can take care of a lot of the nitty gritty
work (like garbage collection), which is perfectly fine for things
like application-writing, which tend to be I/O-bound processes.
However, for certain tasks, like audio, it's still necessary to get
the optimization and lean code that can only be generated by a good C
compiler.

While C is a great language, other languages frankly do provide nicer
ways of expressing logic. Especially for things like audio, languages
that offer vector operations might be much better suited. (For
example, in the academic world, lots of audio research is done in
Matlab for crying out loud... which I don't think is necessary the
best language, but is well-known and good for what they are using it
for. Now imagine being able to directly compile that into a VST or
LADSPA or DSSI instead of having to manually translate it to C..!)
Additionally with the availability of hardware that is optimized for
vector processing (GPUs, the Cell processor, etc..), languages that
can properly (and automatically) take advantage of it would be
welcome.

So why is the rest of the programming world able to move on to new
languages while audio and realtime people are still stuck in the 80's
with C? It doesn't seem fair, and the only reason is that the world
has lost interest in native compilation so there is currently little
effort being put into developing new languages that can be used for
realtime processes.

There are, of course, languages like SuperCollider and CSound, which
ARE made for expressing audio algorithms. However, again they are
generally interpreted. You can run them, but they can't really be
considered equivalent to C, able to be compiled to code linked into a
program or plugin. (Though perhaps there exists ways of generating
plugins from CSound code, I wouldn't be surprised.)

One thing I just learned about recently is Pyrex. It doesn't generate
stand-alone programs but is meant for creating libraries that can be
called from Python -- it generates C code from a Python-like language,
which is structured to be called from Python. This makes sense to
me... why worry about supported the millions of CPU architectures out
there when this is already taken care of by GCC. So instead of
generating ML, generate "portable ML" (i.e., C code), and let GCC take
care of the platform-specific work. I think this is a great idea,
except that I'd like to just write a whole program or plugin in it
instead of making something that is meant to co-exist with Python
"glue code".

I'm definitely going to check out Faust too, as I hadn't heard of it before.

Steve

On 6/14/06, Phil Frost <indigo@email-addr-hidden> wrote:
> On Wed, Jun 14, 2006 at 07:47:36AM +0200, Alex Polite wrote:
> > Hi there.
> >
> > Is it possible to write LADSPA plugins in anything but C/C++? I prefer
> > perl, ruby or python.
> >
> > alex
>
> Anything but C/C++, yes. See FAUST [1], a compiled language designed
> specificly for processing audio streams. Perl, Ruby, or Python, not
> really.
>
> [1] <http://faudiostream.sourceforge.net/>
>
Received on Wed Jun 14 20:15:03 2006

This archive was generated by hypermail 2.1.8 : Wed Jun 14 2006 - 20:15:04 EEST