ofxPd


#1

Announcing ofxPd, an Open Frameworks addon for running an instance of the Pure Data audio environment within an OpenFrameworks application. Audio, messages, and MIDI events can be passed to and from pure data patches and the library is thread safe.

Pure Data is a graphical patching enviornment for audio and multimedia (note: the gui and graphics features are not within the scope of this addon)

https://github.com/danomatika/ofxPd

Note: This is not the ofxPd originally released by Damian (see http://forum.openframeworks.cc/t/announcing-ofxpd-[now-v0.03]/4444/0). This is a new addon using the official libpd library.

It runs on OF 0062, 007, and iOS in OF 007. The example runs great on my iPad.


ofxPd in OF 0.81
#2

Great release Dan! :slight_smile:

For anyone wanting to see an example app using ofxPd on the App Store. NodeBeat (http://nodebeat.com/) currently uses Dan’s version of ofxPd for all the audio elements. It’s running 0062 iOS.

Great work again Dan!


#3

Wow, Great work Dan! :slight_smile:

Today, I try in my iphone and works perfect!


#4

If anyone is close to Weimar DE in 2 weeks, I’m giving a short workshop on using libpd in OpenFrameworks through ofxPd at the Pure-Data-Convention at Bauhaus Uni.

15:30 - 17:30 Marienstraße 7b - room 102


#5

There are now working Linux (Makefile, Codeblocks) and Windows (Codeblocks+MiniGW) project files.

The Windows version required some quick hacks to the pd source, so it’s in a branch until libpd can be updated: https://github.com/danomatika/ofxPd/commits/feature-codeblocks-win


#6

hi, @danomatika i’ve tried the linux version with Makefile without any problems. Many thanks to you for this great addon! :slight_smile:


#7

Can you confirm that sounds work ok? I tested on Ubuntu 10.04 and sound failed every time as PortAudio couldn’t find any devices … perhaps this is only a problem on my test machine? What distro are you using?


#8

Hi,
i am a total noob in this and i am trying a simple project that use the fiddle~ external (iOs 4). Is there any standard basic noob-prof procedure for adding externals?
I read the previous discussions about http://forum.openframeworks.cc/t/announcing-ofxpd-[now-v0.03]/4444/29 but this seems still not clear for me.
Thanks and sorry


#9

i’m using the new version of Ubuntu 11.04 without any problems at all. Maybe it is a problem on your test machine…


#10

Do not apologize, it is a good question and I’m glad you reminded me to write this info down.

It’s now on the ofxPd readme: https://github.com/danomatika/ofxPd

The main points are you need to include the external lib sources in your project and call the external’s setup function after initializing ofxPd.


#11

Hi @danomatika,

I use ofxPd for my project and I meet a problem about adding Pd external libraries.
When I tried to add another external libraries (cyclone or zexy), I always got error message like

>_<

If i remove the external libraries from code, it works well.
So, I think there is a conflict between external lib and OF lib, because error message is “duplicate sysmbol _urn_setup …”

Please help me. :’(

janet


#12

hi danomatika and all,

i got problems compiling the ofxpd_win example. seems as if it’s build under OF007. think it includes references to all 007 specific libs and addons. too much workaround to remove all these.

ok, it compiles under 007 but i don’t hear any sound. it should be outputting tones by hitting letter-keys and update the drawn line, right?

the console output tells me that midi is not supported under win, but OF sends list-elements (integers) to pd. so i think midi is not necessarily needed to produce sound. well, could you have a look at the console-screenshot to say if pd-test runs well on my machine? you might probably recognize a reason why i don’t hear anything…

(…unfortunately i read about your libpd-workshop in weimar too late. i arrived there few days later, but i could have been there earier if i only knew. i would have really appreciated taking part. well, hopefully next time!)

thanks in advance and for the addon. curious to get it working!

ron.


#13

I have the same problem with adding external libraries. I need to add zexy and cyclone. Could anyone provide more detailed instructions than are currently available.

Thank you.


#14

As is states in the readme, did you add function declarations for the library setup functions? For example:

  
extern "C" {  
    void zexy_setup();  
}  


#15

The codeblcoks projects for win are for 007. I did not make any for 0062, as 007 is now out. You only have to swap out Glee for Glew and remove the libs added to 007, including cairo and tesselator.

Yes, sound should be playing. It works on my test machine running Win7.

Those midi objects ([midiin], [sysexin]) are for receiving raw midi bytes and are only tested for feature completeness. I believe they and [notein], [ctlin], [pgmin], etc work fine on windows as you can see since they received the data in the midi test. I think the warning prints are old and they have actually been updated within the pd core, but the warnings have not been removed. In any case, most people do not use [midiin] and [sysexin].

And no, midi is not used for controlling the sound generation, it’s a list being send from OF. It’s simply being tested by sending data and printing whatever is received to the console.


#16

See the readme as mentioned several posts back …


#17

Hi Dan,

I have the externals compiling ok. My app launches but there is no sound. In the xcode console it says that the external objects couldn’t be created, (full list below). The program is running on the ipad simulator - could there be a problem with the externals working with ios?

  
Patch: "" $0: 0 valid: 0  
 kalashnikov 8  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 mp3play~  
error: ... couldn't create  
 oggread~  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 split~ 1  
error: ... couldn't create  
 split~ 0.5  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 kalashnikov 8  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 mp3play~  
error: ... couldn't create  
 oggread~  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 split~ 1  
error: ... couldn't create  
 split~ 0.5  
error: ... couldn't create  
 kalashnikov 8  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 mp3play~  
error: ... couldn't create  
 oggread~  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 split~ 1  
error: ... couldn't create  
 split~ 0.5  
error: ... couldn't create  
 kalashnikov 8  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 cyclone/svf~  
error: ... couldn't create  
 envrms~  
error: ... couldn't create  
 mp3play~  
error: ... couldn't create  
 oggread~  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 prepend 0  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 oneminus  
error: ... couldn't create  
 split~ 1  
error: ... couldn't create  
 split~ 0.5  
error: ... couldn't create  
 z~ 64  
error: ... couldn't create  
 limiter~  
error: ... couldn't create  
 z~ 64  
error: ... couldn't create  
 limiter~  
error: ... couldn't create  
 kalashnikov 8  
error: ... couldn't create  
 prepend label  
error: ... couldn't create  
 prepend label  
  


#18

I have followed your instructions in the read me. Still getting problems. Can you send me an example xcode project that has a successfully compiled external so that I can use it as a reference. That would be extremely helpful.

Thank you.


#19

Sorry, but this is an open source library and I don’t have the time/energy to field individual support requests for every problem. I provided the information that worked for me.

Also, zexy is under the GPLv2, so it’s incompatible with the Apple App Store, as noted in the ofxPd readme. I’d suggest you check out the rjlib group of externals which aim to provide a set of useful Pd-Vanilla abstractions.


#20

I’m thinking of updating the api to match the official libpd api. There is interest from the libpd devs to include the ofxPd architecture as the official C++ wrapper. I can do this without changing the ofxPd api, but I think it makes more sense in the long run to do so.

Let me know what y’all think.

The main changes would be:

Have the receiver set on finish:

  
  
void startMsg(const std::string& dest, const std::string& msg);  
void addFloat(const float value);  
void addSymbol(const std::string& symbol);  
void finish();  
  

become

  
  
void startMsg();  
void addFloat(const float value);  
void addSymbol(const std::string& symbol);  
void finishList(const std::string& dest);  
void finishMsg(const std::string& dest, const std::string& msg);  
  

channels are the first arguments in midi functions:

  
  
void sendNote(const int pitch, const int velocity=64, const int channel=1);  
void sendCtl(const int controller, const int value, const int channel=1);  
void sendPgm(const int value, const int channel=1);  
void sendBend(const int value, const int channel=1);  
void sendTouch(const int value, const int channel=1);  
void sendPolyTouch(const int pitch, const int value, const int channel=1);  
  

become

  
  
void sendNote(const int channel, const int pitch, const int velocity=64, );  
void sendCtl(const int channel, const int controller, const int value);  
void sendPgm(const int channel, const int value);  
void sendBend(const int channel, const int value);  
void sendTouch(const int channel, const int value);  
void sendPolyTouch(const int channel, const int pitch, const int value);  
  

The *source functions become un/subscribe functions:

  
  
void addSource(const std::string& source);  
void removeSource(const std::string& source);  
bool sourceExists(const std::string& source);  
void clearSources();	/// listeners will be unsubscribed from *all* sources  
  

become

  
  
void subscribe(const std::string& source);  
void unsubscribe(const std::string& source);  
bool isSubscribed(const std::string& source);  
void unsubscribeAll();	/// listeners will be unsubscribed from *all* sources  
  

The un/subscribe functions would become *Listener functions:

  
  
void subscribe(ofxPdListener& listener, const std::string& source="");  
void unsubscribe(ofxPdListener& listener, const std::string& source="");  
bool isSubscribed(ofxPdListener& listener, const std::string& source="");  
  

become

  
  
void addListener(ofxPdListener& listener, const std::string& source="");  
void removeListener(ofxPdListener& listener, const std::string& source="");  
bool listenerExists(ofxPdListener& listener, const std::string& source="");  
  

A pd:: namespace:

Owing to the number of small utility objects (Patch, List, etc), I’d like to encapsulate everything within a pd namespace. Does this make sense?