Re: [linux-audio-user] writing a realtime app in python

From: Jack O'Quin <jack.oquin@email-addr-hidden>
Date: Tue Mar 20 2007 - 01:55:53 EET

On 3/19/07, Atte André Jensen <atte.jensen@email-addr-hidden> wrote:
> Hi
>
> I just installed csound5 with the python bindings, and now I'm eager to
> explore the possibilities with audio/python. I've done a fair amount of
> python programming, but so far my experiences with audio has been with
> PySeq (which I found pretty straight-forward). I hope someone here can
> answer a few initial questions:
>
> 1) How do I spawn a thread that has realtime priorities (like with "chrt
> -f -v 70 csound some.csd")?

I am not sure that is a meaningful operation in a language like
python (see below)...

> 2) I'd like to have several csnd's running, each in its own thread, but
> "collecting" the audio produced into one stream that should be
> output'able to both alsa and jack (obviously not at the same time, so
> maybe "either/or would be more descriptive). Is that possible and which
> python library should I look into?

I'm not an expert in python (just started learning it recently), but
I am fairly sure you will not be able to handle JACK process callbacks
in python because a call to the global garbage collector at that point
will almost certainly blow your realtime deadline, causing JACK to
kick your client out of its realtime processing graph.

You could code those parts of the program in C or C++ to avoid
memory management in the "harder" realtime portions of your
application. With sufficiently large ringbuffers (or the like), the
other parts can probably be written in python with some higher
latency.

> 5) Besides *only* runnining the csnd instances in seperate rt threads,
> are there other things I need to be aware of or avoid for the
> application to perform well under jack and/or alsa? Also considering I'm
> gonna make it gui driven (been looking at WxWidgets, and although I'm
> totally new to gui programming it looks nice).

I don't know enough about csnd to comment on this part of the
problem.

> Answers and/or pointers to relevant online info is greatly appreciated,
> thanks in advance!

Disclaimer: I am only a beginner python programmer. Nice language,
however.

-- 
 joq
Received on Tue Mar 20 04:15:03 2007

This archive was generated by hypermail 2.1.8 : Tue Mar 20 2007 - 04:15:03 EET