Announcing ofxPd [now v0.03]

Hi everyone,

This is to announce that ofxPd v0.02 is available at http://github.com/damiannz/ofxPd/downloads

ofxPd is an addon for openFrameworks that embeds the Pure-Data synthesis engine in an openFrameworks application. It is based on pdlib-by-Bryan-Summersett, which in turn is based on Pure-Data v0.42.5 by Miller Puckette et. al. It requires the ofxThread addon.

Now (v0.03) includes direct-to-Pd-engine messaging: no need for OSC stuff any more. An example is included which requires the ofxThread, ofxPd and ofxOsc addons.

ofxPd is released under a BSD-style license; see LICENSE in the ofxPd/ folder for details.

Yay!

Will it be a lot of work to upgrade this addon with newer version of Pd?

Would also be great if you can be bothered to replace the readme.txt with an install.xml and put it at addon root level (with appropriate tags).

Thanks!

Wow great job Damian!
Do you know if addon work for OF iphone?

mar

yeah pierre, that was the next plan. also i revamped the way audio was being processed today, to make it work better on my beagleboard. expect v0.02 just as soon as my opening is finished (tomorrow night!)

hey Mar, i’m not sure to be honest, but if the ofSoundStream stuff (audio callback via the audioRequested function, see examples/audioOutputExample) is working on iPhone then so will this!

some changes to the example to work on mac:

  
  
//--------------------------------------------------------------  
void testApp::setup(){  
  
	ofBackground(255,255,255);  
  
  
	// setup osc  
	static const string HOST = "localhost";  
	static const int PORT = 11011;  
	osc_sender.setup( "localhost", 11011 );  
	  
	// setup Pd  
	// use data/ as the Pd libdir  
	// default channel setup (2 channels, 44.1 kHz audio, 64 sample block size)  
	pd.setup( "/" );  
	// on startup, open data/two_osc.pd  
	pd.addOpenFile( "two_osc.pd" );  
	// start pd  
	pd.start();  
		  
	// setup sound output, 2 channels out, 44.1 kHz  
	ofSoundStreamSetup(2,0,this, 44100, 256, 4);  
  
	ofSetFrameRate(60);  
  
}  
  

first – I moved the ofSoundStreamSetup to the bottom, since PD needs to be initialized before the audioRequested function gets called (it was crashing if it called that to early)

also, ofToDataPath("") seems unhappy, on mac (will report this on github as it’s an OF error), so I made it ("/") instead. after this example is loading and working…

take care,
zach

here’s a first pass at getting ofxPd to work on iphone / ipad – it’s an 0061 project for iphone (that contains ofxOsc, ofxThread, and ofxPd in the source folder, as locally included addons)

I had to do some hacking to get this to work, but it works. will do a diff and list there changes, there are a few things that were funky (and changes to pdlib to make it work with iphone). will try to list them out in a second.

take care,
zach

iphone_ofxPd.zip

here’s a very first pass at supporting audio input as well as output. simple examples like delay lines work. fun times!

some points:

a) it’s very messy – sorry! full of hard coded stuff
b) I’m not very confidant in the PD pipeline, so please look at my audio functionality in ofxPd. … I added input as well as output there
c) have enabled logging to the console (modified the dopost function) and a ton of debug stuff. will look later at making that optional
d) patches seem to need to have the OSC stuff in them, or else they don’t run (that seems obvious, but it took me a while to figure this out)
e) this is without my above mods for ofxIphone – please use a diff tool if you want to compare all the changes.
f) I’ll get all this into git shortly – just am posting projects as I go since it’s easier (and our internet is very slow here).

I will work on cleaning this stuff, but wanted to throw up a version as we make changes over here. We’ve got an OF surfing / camping workshop happening in japan, and we spent last night playing with ofxPd on ipads, and are having alot of fun. Surf during the day and code at night :slight_smile:

take care,
zach

ofxPdInputOutput.zip

patches seem to need to have the OSC stuff in them, or else they don’t run (that seems obvious, but it took me a while to figure this out)

actually, I was wrong here – they just need the load bang section (which I had been missing…) not the OSC stuff - in order to work. (the part that looks like loadbang -> del 200 -> pd dsp 1)

  • zach

Surf during the day and code at night

This is gold.
Having moved back to Australia recently, I’m going to have to attempt this. :wink:

more changes – here’s a merge of iphone and input + output - meaning that things like delay line can work on iphone / ipad :slight_smile: on the nerd side, ofxPd has provided alot of fun so far… (thanks damian!)

take care,
zach

iphone_inputOutput_ofxPd.zip

here’s some modified projects with new ofxPd.h file to add the bsd license for pdlib (since it uses some code from pdlib – to hook into the audio system). I was contacted by the authoer of pdlib (who did a great job on that library) that he’d like the license info to be proper, so I’ve tried to get it right and will ping damian to make the changes to ofxPd himself…

[attachment=0:3856mm7v]ofxPdInputOutput.zip[/attachment:3856mm7v]
[attachment=1:3856mm7v]iphone_inputOutput_ofxPd.zip[/attachment:3856mm7v]

iphone_inputOutput_ofxPd.zip

ofxPdInputOutput.zip

hi Zach,
all this looks great, glad it’s being used!

i’ll make a go at pulling it all into my git repo in the next couple of days… yeah, i got contacted by the original author as well – the initial release was all put together in spare moments during an exhibition install so i kind of overlooked the licensing stuff, whoops :slight_smile:

cool – thanks again for this, it’s been fun to hack on.

one other things I’ve experimented with here is getting externals to work. On iphone, it’s especially tricky since there are no compiled external (afaik) for iphone. here’s some tips:

a) try adding the source code to the external directly to your project, and make sure that all it’s paths can be found (might require editing header search paths and or editing code – I had to fix some funky relative header includes that were built for makefiles).

b) you may need to alter some #defines, like #define MAC_OSX or #define LITTLE_ENDIAN, etc, since these externals were usually built to be compiled cross platform. getting a non core (ie not in the pd svn) external to compile is bit of work usually - simple stuff tends to go smoothly, but more complicated ones (I got cyclone to compile) take some finessing.

c) one the external itself compiles, then in m_pd.c, in ofxPd/libs, alter the function:
void extras_init(void)

for example, after getting expr and peakamp to compile (with alot of funky wrangling) my function looks like:

  
void extras_init(void)  
{  
    // mrpeach 'net' files  
    tcpclient_setup();  
    tcpreceive_setup();  
    tcpsend_setup();  
    tcpserver_setup();  
    udpreceive_setup();  
    udpsend_setup();  
      
    // mrpeach osc files  
    packOSC_setup();  
    pipelist_setup();  
    routeOSC_setup();  
    unpackOSC_setup();  
  
    expr_setup();  
    peakamp_tilde_setup();  
	  
}  

I hope this helps – I’ll upload a project later with these externals compiling, so people can see how it’s been done.

take care,
zach

Hey guys,

I’m soooo excited to be able to play with Pd as the sound engine for OF apps. Thanks for this huge push, Damian. And thanks for making it it mac/iPhone happy, Zach. Noticed that the changes got pushed to Git!

Anyway, I’ve been tooling around with the example a little bit and I decided to try making my own Pd patch. I’m stuck though when I try to add the OSC objects into my own. If I simply try to create the objects, the log window says “couldn’t create”. If I try to paste them from the two_osc.pd patch into my patch, the log window also says “couldn’t create”.

I suspect it has something to do with “externals” or something? Don’t know much about those, but I opened the two_osc.pd in a text editor and didn’t see anything in there that was missing from my own patch.

Sorry, I’m sure this is n00b territory here!

-Aaron

throwing an “import mrpeach” object into the patch seemed to do the trick! Might be instructive to include that in the example patch just so we Pd n00bs can follow along at home!

hey folks,
updated – now at v0.02, including Zach’s input fixes, a tidier setup interface with more options, and more explanatary comments in the example.

available at http://github.com/damiannz/ofxPd/downloads

enjoy!
d

hey,

just a quick note to say v0.03 has been released.

now has an install.xml and direct-to-Pd-engine messaging, so no need to interface using OSC.

still available at http://github.com/damiannz/ofxPd/downloads.

cheers
d

Great work Damian! Looking forward to using it in future projects…

What is the proper way to deal with referencing externals in the form of other .pd files?

I’m trying to use mapping/autoscale in a patch in ofxPd and it doesn’t seem to work. I copied the autoscale.pd file into the data folder. My first thought was that maybe the main patch I’m working on would automatically load it itself, but that now seems silly. So I tried a couple other things. In the testApp:setup() I called pd.addOpenFile( “autoscale.pd” ), but no luck with that. I also tried including an “import autoscale” and “import autoscale.pd” object inside the patch, but that also didn’t help.

I suspect there is a simple solution, but I’m pretty new to this.

-Aaron

I’m planning to release my musical instrument application using oF and ofxPd at app store. I read ‘LICNSE’ of ofxPd and I understand that I need to mention the text below in application somewhere or in manual.

Copyright 2010 Damian Stewart, Bryan Summersett. All rights reserved.

Is there any other requirements to use ofPd for releasing?
This is my first application to publish…So, I have so many question about License issue.

Please tell me the link I should read if you know the useful link about License.

Thank you

Koutaro