Re: [ecasound] ecasound and lua?

From: Philipp Überbacher <hollunder@email-addr-hidden>
Date: Tue Jul 27 2010 - 10:46:13 EEST

Excerpts from Joel Roth's message of 2010-07-27 04:29:14 +0200:
> On Mon, Jul 26, 2010 at 04:47:17PM +0200, Philipp ??berbacher wrote:
> > Excerpts from Joel Roth's message of 2010-07-26 10:43:34 +0200:
> > > On Mon, Jul 26, 2010 at 12:59:21AM +0200, Philipp ??berbacher wrote:
> > > > The features I have planned at this time are:
> > > > 1) A fast 'takes' system
> > > > 2) simple recording
> > > > 3) simple playback
> > > >
> > > > 1) No major problems here, it should be a matter of a couple of string
> > > > operations. One thing I have yet to figure out is how to specify the
> > > > location of the file it records, it seems the home directory is the
> > > > default.
> > >
> > > If you specify "-o:foo.wav", I believe Ecasound will record
> > > foo.wav to whatever is the current directory in the shell
> > > where the Ecasound process is started up.
> > >
> > > If you specify "-o:/some/path/foo.wav", Ecasound will
> > > record exactly there.
> > >
> > > (As Ecasound IAM, probably "ao-add /some/path/foo.wav".)
> >
> > Thanks, this seems to work fine, as long as the path already exists :)
>
> No problem then, since you're a master of your own system. :-)

Yep. In the long run this can be made cleverer, 'projects' and a
directory for each project that can probably be created from lua, and
all that stuff, but for now the simple way is sufficient. I have too
many improvement ideas that have to wait due to time constrains.

> > > The Examples and User Manual docs are your best
> > > reference for common tasks. :-)
> >
> > One thing I couldn't find: How do I quit ecasound via net-eci?
> > 'quit' quits only the connection, that much it did tell me :)
>
> Why do you need to close Ecasound? If you issue
> cs-disconnect, Ecasound will stay there quietly and happily.

Well, I like to clean up behind me. Guess it isn't necessary yet.

> If you need it, how about the lua equivalent to
> system('killall ecasound') ?

I thought there might be a nicer way, but I guess this will have to do.

> > > > 2) I have a hard time figuring out what's needed to prepare a chain
> > > > setup for recording.
> > > >
> > > > - a chain setup, selected
> > > > - a chain, selected
> > > > - input and output for the chain
> > > > - engine-launch
> > > > - start
> > >
> > > A chain needs to be selected only for adding/removing chain
> > > operators, adjusting chain operator parameters, etc.
> > >
> > > A newly created or loaded chain setup is automatically
> > > selected.
> > >
> > > Starting the engine automatically launches the engine
> > > if necessary.
> >
> > I think I'll try to be verbose for now. At some point it may give more
> > control over what happens.
> >
> > > > And for shutdown?
> > > > - stop
> > > > - and then? It seems my file wasn't properly closed.
> > >
> > > I believe stop should be enough for Ecasound to close
> > > the file.
> >
> > A subsequent start seems to be able to continue with the same file
> > though.
>
> Okay, then what about stop, then cs-disconnect?

I think it even leaves the old file in place and overwrites it for as
long as you record. take1 30sec, take2 15sec -> take2+last 15 sec of
take1 :)

Yep, something like stop always followed by cs-disconnect is what I
thought last night as well. Depending on what it is set to (record or
play) it will select the appropriate chain. Something like that, need to
be careful not to mess stuff up at this point though :)
Why do good ideas always show up when I try to sleep? :)

> > > > I do record from jack, but the bitdepth was set to 16bit. I couldn't
> > > > figure out how to change that.
> > > >
> > > >From the command line (or in a chain setup file):
> > >
> > > -i:jack,system -f:f32_le,1,44100 -o:foo.wav
> > >
> > > This records in 32-bit floating point format (same as JACK input)
> > >
> > > As an Ecasound IAM command, I believe the equivalent is:
> > >
> > > cs-set-audio-format f32_le,1,44100
> >
> > Ah, yes, that works too :)
> > I most likely missed the _le part
>
> I believe that little-endian (_le) is the default, and
> can be omitted.

Ah, thanks, will try. Would be nice if I could omit that, as it's
something I don't usually care about.

> > I would have expected it to default to the input format, and I think I
> > read some piece of documentation somewhere that says it does.
> >
> I believe that the specified format applies to all
> subsequent inputs or outputs. So the command order
> might be:
>
> add chain
> specify format 1
> create input
> specify format 2
> create output

Yep, but I thought that a jack input/output leads to jack bitdepth by
default. It would only be logical and it's easily overwritten.
Example: ai jack -> ao some.wav (32bit, jack_samplerate)
         ai someother.wav (16bit, 2ch, some_samplerate) -> ao jack <--
         this needs at least some resampling, guess 16 to 32f bitdepth
         doesn't hurt (and not help either)

> > > > There's also this line, from aio-status, which doesn't tell me a lot:
> > > > -> closed, audio format not available until object is opened.
> >
> > This is still a bit confusing for me, no idea what it tries to tell me.
>
> Perhaps you'll see something after engine-launch.
>
> And if you have specified it yourself, you don't
> really need an answer :-)

I think it's gone after engine-launch. Well, I guess I don't need to
understand all of what ecasound says.

> > I spent most of today to hunt and squash a single bug. Almost
> > frustrating :/
> > I did find the problem and a rather ugly solution that I don't fully
> > understand.
> > The issue I have is ecasounds response when I send it a String
> > containing nothing but "\r\n".
> > It seems to send two responses, first:
> > 256 0 -
> >
> > And then an empty string as a separate response. It may just be an
> > additional <crlf><crlf>. Anyway, the response is different from others.
> > My program assumes a single response in order to correlate the sent
> > message with the response, so this additional response confused it.
> > Well, did you experience something similar? Other responses work fine.
>
> I haven't observed this. Maybe just dumb luck on my part.

I don't know how you receive the messages, it may simply be in a more
clever way :)
For now I receive them line-by-line and assume an empty line is the end
of the message. I didn't find a clear definition of the message end, but
I guess the length can be used for this purpose.

Another command that messes my logic up is jack-list-connections.

Well, one day I'll either figure out how to take care of those cases or
simply implement a hopefully more robust receive using the length.

> > I guess those are the fine subtleties that make programming fun :)
>
> Yes! You will be facing all these issues so that others
> after you won't have to. :-)
>
> Cheers,
>
> Joel

Actually there aren't so many issues, it's mostly a lack of knowledge on
my side. Lack of knowledge with regards to general programming
techniques, lua, or pattern matching. Well, it goes pretty well at the
moment, I'm having lots of fun, and I guess I'll get it to the state
where it's usable for my purpose today.
Basic input parsing works, I only need to hook it up to sensible command
arrays. A few smaller things need to be done still, but it looks like it
will work out. :)

Thanks for answering those mails, I think it helps to talk about it.

Best regards,

-- 
Philipp
--
"Wir stehen selbst enttäuscht und sehn betroffen / Den Vorhang zu
und alle Fragen offen." Bertolt Brecht, Der gute Mensch von Sezuan
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Ecasound-list mailing list
Ecasound-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list
Received on Tue Jul 27 12:15:02 2010

This archive was generated by hypermail 2.1.8 : Tue Jul 27 2010 - 12:15:03 EEST