libpd with Processing

Since early January 2012 I have been working with libpd, which is an embedded library allowing developers to use Pure Data as a sound engine in their applications.  If you have not used Pure Data it is a patcher language for audio synthesis and MIDI developed by Miller Puckette many years ago.  It’s sister language, Max/MSP, is similar in style but since being bought by Cycling ’74 it has changed dramatically.

Libpd is being developed by Peter Brinkmann, RJDJ, Hans-Christoph Steiner and Peter Kirn among others.  They have done something quite revolutionary by taking the two worlds of musicians and sound designers and linking them directly to developers.  Miller Puckette did this with his first versions of Max/ISPW and Max/FTS, etc…now you can develop in Pure Data and embed them into iOS applications, java and Processing.

This post is meant to document my installation of libpd for Processing or rather the puredatap5 library.  This is for Mac users only.  Sorry, we (my friend Stjepan and I) can’t figure out how to get it to work on Windows. : (  I had some problems with the distributions’ instructions, essentially they did not work.  But with some luck and lots of digging through code I figured it out.  There are three initial steps.

1)  Get Processing 5

2)  Get Pure Data .43 (I used .42-5)

3)  Get Jack for Mac OS 10.6 (Jack is an audio connection kit that can be used as an audio server between programs.)

Install the necessary software packages.  Then download this puredatap5 and put into the libraries folder in your Processing folder.  If the libraries folder doesn’t exist, create it. Make sure the folder from the archive is named puredatap5.  I created this archive from various parts of the libpd distributions.

4)  In the Processing/libraries/puredatap5 folder go to library/macosx.  There should be two .dylib files in there.  Copy and move those to the /System/Library/Frameworks/JavaVM.framework/Libraries.  Make sure you keep a copy in the current folder too.  Copy and Move, not just move.  You will be prompted to enter your admin password, so make sure you have that.

5)  Open your JackPIlot.app and click (start).

6)  Open Processing 5 and run the xyPad.pde demo that comes with the distribution.  It should magically work.  If not, then check the versions of the software you downloaded, make sure Jack is running, make sure your sound is turned on, and all that other obvious stuff.  If it still does not work, you can comment or send me a message, at robert (at) urbanstew (dott) org.

There is no API to help you figure out how data is being passed from the pure data patch and the processing language so use the example provided.  You can also dig through the source code and make your own API.  That would be helpful.