[ecasound] update: ECI API

New Message Reply Date view Thread view Subject view Author view Other groups

Subject: [ecasound] update: ECI API
From: Kai Vehmanen (k@eca.cx)
Date: Tue Nov 28 2000 - 18:17:33 EET

As some of you might already have noticed, couple of new directories have
been added to the CVS-tree: ecasound/libecasoundc and ecasound/pyecasound.
The first one is a C-library implementing the Ecasound Control Inferface,
and the second a Python version of the same thing.

You can already write a simple app using the C-api. Pyecasound doesn't yet
do anything useful, but you can compile it and install the produced Python
module. Then pretty much all you can do is "import pyeca ; a =
pyeca.ECA_CONTROL_INTEFACE()". But nevertheless, it's a good start.

I will also implement this in C++ (class ECA_CONTROL_INTERFACE). I'm not
yet sure whether to put it to libecasound, or to add a separate library
(libecasoundci?) and possibly avoid compatibility problems.

So what's left is to actually implement the ECI services. I've given this
a lot of thought, and managed to reduce the API quite a bit. Reasons for
doing this are:

- minimal API is simple to port to new languages (Perl for example)
- features can be added without affecting the API -> apps using the
  ECI API don't need to be rewritten every once in a while

Ecasound Control Interface - proposal 2

- issue an iamode command (direct, formatted string)
- last string
- last list of strings
- last integer
- last long integer
- last double
- error flag (int/boolean)
- last error (string)

Yup, that's it. I left out most of the services listed in the first
proposal. The idea here is that all operations are done by issuing
an ia-mode command. For functions that return a value, you check the
ia-mode documentation and lookup the return type of that function, and
then, use the above functions. So for example, getting a list of chains
would look something like:

eci_command("cs-select record") # select chainsetup "record"
eci_command("c-list-all") # list all chains of "record"
a = eci_last_list_of_strings() # copy the list to 'a'
if len(a) > 0
        eci_command("c-select " + a[0]) # select the 1st chain

What do you think? I still have to think about what last_* services are
really needed, and possibly, is some type of return value missing from the
list. This is a somewhat tricky question. The more last_* types you have,
less parsing you have to do in apps using ECI, but on the other hand, if
"last_string()" was the only variant, you wouldn't need to check ia-mode
documentation all the time. Also, a possibility to issue an ia-mode
command with a numerical parameter would also come handy. For instance:

eci_command("aio-add-input wicked_drums.wav")
eci_command("aio-add-output /dev/dsp")
eci_command("cop-add -efl:400") # add a lowpass filter
eci_command("start") # start processing
finished = 0
while(finished == 0)
   sec = 0.0
   while(sec < 10.0)
      sleep(1) # sleep for 1s
      eci_command("cs-position") # fetch current pos in secs
      sec = eci_last_double()
   eci_command("cop-select 1") # select the lowpass filter
   eci_command("copp-select 1") # select the 1st param (=cutoff)
   eci_command("copp-value") # fetch the current filter freq
   value = eci_last_parameter()
   value = value + 400
   eci_command_numeric("copp-set", value) # set a new value
   eci_command("cs-is-finished") # check whether still running
   finished = eci_last_integer()

This would play the 'wicked_drum.wav' applying a lowpass filter
to the signal before sending it to /dev/dsp. Every 10 seconds,
the filter's cutoff freq would be increased by 400Hz (ok, not really
useful :)).

Now I want to emphasize that I _don't_ want to turn ecasound (or any part
of it) into a programming language. There are plenty of complex audio
languages available (Csound, Common music, Cmix, Saol, etc, etc). My
intention is that ia-mode commands are something that any ecasound user
can use. The added bonus is that the same commands are always available:
you type them in ecasound's own ia-mode (ecasound -c), you launch ecasound
on the background and send the commands from your app, use one of the ECI
APIs directly, etc, etc ... So if my proposals start sounding too
weird and/or complex, please, stop me at once! :) ... (I can already see
myself waking up, a couple of years from now, realizing that I have just
reimplemented csound. Uhm, a terrible way to start your day. ;D)

 . http://www.eca.cx ... [ audio software for linux ] /\ . 
 . http://www.eca.cx/sculpscape [ my armchair-tunes mp3/ra/wav ]

-- To unsubscribe send message 'unsubscribe' in the body of the message to <ecasound-list-request@wakkanet.fi>.

New Message Reply Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Nov 28 2000 - 20:33:26 EET