Re: writing a realtime app in python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jack O'Quin wrote:

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.

I'm pretty sure that's not gonna be a problem. This is a python API to csound, which is (obviously) written in C. This is from the test.py included with csound:

csound = csnd.Csound()
csound.Compile('-o', 'dac', 'trapped.csd')
while not csound.PerformBuffer():
    pass
csound.Reset()

So basically sound.PerformBuffer() is everything, the rest is just bookkeeping (which python is great for). So I simply need to spawn that in a seperate thread with realtime priorities.

Any ideas?

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.

My intial tests shows the python API berforms just as good as tegular csound, with buffers set to -b32 and -B64

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

It's the nicest :-)

--
peace, love & harmony
Atte

http://www.atte.dk      | quintet:      http://www.anagrammer.dk
                        | compositions: http://www.atte.dk/compositions

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux