[LAD] Communicating between python UI and C++ engine for real time audio?

Paul Coccoli pcoccoli at gmail.com
Thu Nov 3 20:51:57 UTC 2011

On Wed, Nov 2, 2011 at 8:26 PM, Iain Duncan <iainduncanlists at gmail.com> wrote:
>> If the python stuff is only for the gui and non-realtime stuff, this is a
>> very
>> practical approach. There are quite a few people doing that. I believe
>> Fons'
>> session managment and assorted apps are running that way (altough he
>> doesn't
>> seem to release them). Some of my prototype apps for the next-generation
>> JackMix are built that way. And I would have done this for my
>> university-job
>> project had I learned python earlier.
>> Doing applications in python with the sound-stuff happening in a separate
>> C-
>> compiled thread) gives that advantage that you can implement the apps as
>>  modules and run them either stand-alone or within a bigger controlling
>> app.
> Thanks. If you have any, or know of any, examples I'd love to look at them.
> Iain

I have some code somewhere that uses Boost.Python to expose a Jack
MIDI port.  So I can generate MIDI in Python, then pass it to the jack
thread vi jack_ringbuffer, then out the app's MIDI port.  Using
pygame, for example, I wrote a simple python app that turned joystick
button presses into MIDI notes so I could play drums with my gamepad.
I also interfaced it to the mingus python package
[http://code.google.com/p/mingus/] so that I could write mingus apps
that send midi data to the jack midi app of my choice instead of
mingus' built-in fluidsynth.  I have a simple llittle pygtk app that
draws a button for each chord in the chosen key and sends that chord
out as midi on button presses.  Fun!

I hope to one day clean it all up and put it somewhere, plus add
support for passing NumPy arrays to the jack thread to send out an
audio port, yada yada, more hot air and empty promises, etc...

There was another thread a few months back about message passing in
C++ for jack apps.  It might be worthwhile to revisit that thread in
the context of wrapping things with Boost.Python.

More information about the Linux-audio-dev mailing list