| >I was wondering whether it would be possible to alleviate
>some of the shortcomings of the Csound language by
>building instruments in a more friendly and ``higher level''
>programming language, then using a ``translator'' of some sort
>to change the given orchestra into csound format. Thus, the
>orc file would be a ``low-level'' intermediate stage, much like
>the object files created by C compilers.
The orchestra compiler in Csound is exactly such a translator - it
translates orchestra language into Music V opcode constructs.
>My question is: Is the Csound language sufficiently
>`complete'' to support most modern logical constructions (even
>if implemented in some sort of ugly way), or would such a
>`higher level'' language be simply a cosmetic improvement?
A language is complete if it supports the programming constructs block,
case, and loop. Csound does. But they are all awkward in Csound because
they must be implemented using labels, if, and goto.
A next generation sound processing language could be implemented either as
an object-oriented opcode language, a Csound with classes, or it could be
implemented using a virtual base class for signal processing and synthesis
objects that could be written in C or C++ and that would plug into the
soundfile compiler at run time.
Actually, both methods use a virtual base class - the Csound (lower-level)
approach makes the opcodes derive from the virtual base class, and the
other (higher-level) approach makes the instruments themselves derive from
the virtual base class.
The object-oriented opcode language could be implemented by writing opcodes
as native methods for Java, and Java would then be the actual opcode
langauge for writing instruments. The existing Csound opcodes could more or
less be dropped into Java classes with the same data members and methods as
struct oentry:
interface Oentry {
public:
void onInitialization();
void onKontrol();
void onAudio();
};
class OpcodeBase {
public:
static int sr;
static int kr;
static int ksmps;
static int nchnls;
int functionCount;
int functionSizes[];
double functions[][];
int pCount;
double pFields[];
};
However, the higher-level approach offers some advantages, as most people
who program already know C and performance would be better. Csound has the
virtual base class (struct oentry) but not the plugin objects - except of
course for my build of Csound. I am still pondering these questions.
|