Hello
Pleas forgive me if this is already answered somewhere, but with the keywords I was using, I couldn't find anything. What I would like to do is manipulate a patch running in pd through an API in some other programming language. I know that I can send data to an existing patch from other languages through osc, midi, custom externals, etc. What I would like to be able to script is the manipulation of the actual patch. ie: add an osciliator and wire it up to this output. remove the connection between these two object, etc. I know that I could output programatically generated .pd files and then load those in, but this does not allow for real time editing of those patches. Is there a standard way of doing this? Has anyone tried it?
thanks!
zach dwiel
Zach Dwiel wrote:
Hello
first of all, there is no official API.
second, you can manipulate a Pd patch by "sending messages around". this is (inofficially!) documented by several people, and usually called "dynamic patching". there is also a tutorial by damien henry called "pd-msg" which is included in Pd-extended (though last time i checked it seemed to be horribly outdated)
since the messages can originate from wherever using OSC, midi and whatnot, i guess this is what you are looking for.
gfmaesr IOhannes
On Wed, Dec 10, 2008 at 09:05:16AM +0100, IOhannes m zmoelnig wrote:
Zach Dwiel wrote:
Hello
first of all, there is no official API.
It would be so nice if there were an easy way to invoke Pd as a library from within other code. I know it's possible to do this (Spore, pd~, RjDj, Pd browser plugin), it's just that it requires writing a bunch of non-trivial support code that must be re-written every time. It shouldn't have to. Pd -nogui could and should be as easily invokeable as any other library.
For example, I just wish it was possible to go:
#include <pd.h>
*PDInstance pd = make_pd_instance(); pd->init(/* ..args.. */);
while (1) { /* Do stuff here */ pd->schedloop(); /* Do other stuff here */ pd->sendMessage(";my-receiver bang;"); }
Ok maybe not quite as easy as that, but I reckon you'd see Pd used as the audio engine for loads of other apps and games if this was simple. There has already been interest from e.g. the Blender project and the several other apps that already embed Pd.
If this is already easy and I have just missed something obvious, please let me know. (Sorry for not contributing code.)
Best,
Chris.
Yes! Even if it's already 'doable' having a clearly abstracted libPd with documented API is clearly the next step in Pure Data development. This should be an overriding consideration in all current dev directions.
On Wed, 10 Dec 2008 20:07:04 +0900 Chris McCormick chris@mccormick.cx wrote:
On Wed, Dec 10, 2008 at 09:05:16AM +0100, IOhannes m zmoelnig wrote:
Zach Dwiel wrote:
Hello
first of all, there is no official API.
It would be so nice if there were an easy way to invoke Pd as a library from within other code. I know it's possible to do this (Spore, pd~, RjDj, Pd browser plugin), it's just that it requires writing a bunch of non-trivial support code that must be re-written every time. It shouldn't have to. Pd -nogui could and should be as easily invokeable as any other library.
For example, I just wish it was possible to go:
#include <pd.h>
*PDInstance pd = make_pd_instance(); pd->init(/* ..args.. */);
while (1) { /* Do stuff here */ pd->schedloop(); /* Do other stuff here */ pd->sendMessage(";my-receiver bang;"); }
Ok maybe not quite as easy as that, but I reckon you'd see Pd used as the audio engine for loads of other apps and games if this was simple. There has already been interest from e.g. the Blender project and the several other apps that already embed Pd.
If this is already easy and I have just missed something obvious, please let me know. (Sorry for not contributing code.)
Best,
Chris.
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I can imagine simply writing an example program to do this (putting some boilerplate first and then a rewritable main at the end). It would look more like this:
/* don't touch me */ .... /* but replace the following with your code */
main() { pd_startthread("arg1 arg2..."); /* do anything you want */ pd_send("foo bang;"); /* etc */ pd_endthread(); }
... the idea would be that pd itself would live in a subthread and you'd be able to send messages to it and even somehow get return callbacks. This wouldn't be like pd~ at all, since in this scenario Pd would open audio and MIDI as needed and schedule itself (with pd~ the subprocess slaves itself synchronously to the parent). Another restriction would be that you could only have one Pd thread (it isn't thread-safe!). On the other hand, this would work fine in Windows, which pd~ doesn't (since windows appears not to offer pipes unless you add a library with funny licensing restrictions.)
Would that be a useful thing to have?
cheers Miller
On Wed, Dec 10, 2008 at 11:28:22AM +0000, Andy Farnell wrote:
Yes! Even if it's already 'doable' having a clearly abstracted libPd with documented API is clearly the next step in Pure Data development. This should be an overriding consideration in all current dev directions.
On Wed, 10 Dec 2008 20:07:04 +0900 Chris McCormick chris@mccormick.cx wrote:
On Wed, Dec 10, 2008 at 09:05:16AM +0100, IOhannes m zmoelnig wrote:
Zach Dwiel wrote:
Hello
first of all, there is no official API.
It would be so nice if there were an easy way to invoke Pd as a library from within other code. I know it's possible to do this (Spore, pd~, RjDj, Pd browser plugin), it's just that it requires writing a bunch of non-trivial support code that must be re-written every time. It shouldn't have to. Pd -nogui could and should be as easily invokeable as any other library.
For example, I just wish it was possible to go:
#include <pd.h>
*PDInstance pd = make_pd_instance(); pd->init(/* ..args.. */);
while (1) { /* Do stuff here */ pd->schedloop(); /* Do other stuff here */ pd->sendMessage(";my-receiver bang;"); }
Ok maybe not quite as easy as that, but I reckon you'd see Pd used as the audio engine for loads of other apps and games if this was simple. There has already been interest from e.g. the Blender project and the several other apps that already embed Pd.
If this is already easy and I have just missed something obvious, please let me know. (Sorry for not contributing code.)
Best,
Chris.
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- Use the source
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
i'd love to see pd going this direction and use it with friends.
processing is a pretty good candidate imo. on osx i could get it to start and open a patch unfortunately not in -nogui mode
i do not understand enough what's possible, but it would be crazy if one could use Pd with titanium, which is the opensource cousin of adobe air. http://titaniumapp.com/
eni
(just keeping this topic alive :) )
Miller Puckette wrote:
I can imagine simply writing an example program to do this (putting some boilerplate first and then a rewritable main at the end). It would look more like this:
/* don't touch me */ .... /* but replace the following with your code */
main() { pd_startthread("arg1 arg2..."); /* do anything you want */ pd_send("foo bang;"); /* etc */ pd_endthread(); }
... the idea would be that pd itself would live in a subthread and you'd be able to send messages to it and even somehow get return callbacks. This wouldn't be like pd~ at all, since in this scenario Pd would open audio and MIDI as needed and schedule itself (with pd~ the subprocess slaves itself synchronously to the parent). Another restriction would be that you could only have one Pd thread (it isn't thread-safe!). On the other hand, this would work fine in Windows, which pd~ doesn't (since windows appears not to offer pipes unless you add a library with funny licensing restrictions.)
Would that be a useful thing to have?
cheers Miller
On Wed, Dec 10, 2008 at 11:28:22AM +0000, Andy Farnell wrote:
Yes! Even if it's already 'doable' having a clearly abstracted libPd with documented API is clearly the next step in Pure Data development. This should be an overriding consideration in all current dev directions.
On Wed, 10 Dec 2008 20:07:04 +0900 Chris McCormick chris@mccormick.cx wrote:
On Wed, Dec 10, 2008 at 09:05:16AM +0100, IOhannes m zmoelnig wrote:
Zach Dwiel wrote:
Hello
first of all, there is no official API.
It would be so nice if there were an easy way to invoke Pd as a library from within other code. I know it's possible to do this (Spore, pd~, RjDj, Pd browser plugin), it's just that it requires writing a bunch of non-trivial support code that must be re-written every time. It shouldn't have to. Pd -nogui could and should be as easily invokeable as any other library.
For example, I just wish it was possible to go:
#include <pd.h>
*PDInstance pd = make_pd_instance(); pd->init(/* ..args.. */);
while (1) { /* Do stuff here */ pd->schedloop(); /* Do other stuff here */ pd->sendMessage(";my-receiver bang;"); }
Ok maybe not quite as easy as that, but I reckon you'd see Pd used as the audio engine for loads of other apps and games if this was simple. There has already been interest from e.g. the Blender project and the several other apps that already embed Pd.
If this is already easy and I have just missed something obvious, please let me know. (Sorry for not contributing code.)
Best,
Chris.
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- Use the source
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi Miller,
On Wed, Dec 10, 2008 at 09:12:23AM -0800, Miller Puckette wrote:
I can imagine simply writing an example program to do this (putting some boilerplate first and then a rewritable main at the end). It would look more like this:
/* don't touch me */ .... /* but replace the following with your code */
main() { pd_startthread("arg1 arg2..."); /* do anything you want */ pd_send("foo bang;"); /* etc */ pd_endthread(); }
... the idea would be that pd itself would live in a subthread and you'd be able to send messages to it and even somehow get return callbacks. This wouldn't be like pd~ at all, since in this scenario Pd would open audio and MIDI as needed and schedule itself (with pd~ the subprocess slaves itself synchronously to the parent). Another restriction would be that you could only have one Pd thread (it isn't thread-safe!). On the other hand, this would work fine in Windows, which pd~ doesn't (since windows appears not to offer pipes unless you add a library with funny licensing restrictions.)
Would that be a useful thing to have?
That would definately be a great start! An example program would be fantastic for now. So would this have to be compiled against Pd sources, or would Pd object files be archived in a .dll or .so files and then this main function would dynamically link against that? The latter would be preferable, but anything along these lines is really excellent.
Eventually it would be really cool to be able to go "apt-get install pdlib" or "pd-dev" and then link programs against Pd. It would also be great for programs to be able to control everything, so they could actually schedule Pd 'ticks' themselves, and they could get the contents of Pd's output buffers for mixing with their own audio stream or whatever. (Isn't that what Spore does?) I guess small steps first. :)
Thanks for your work!
Best,
Chris.
PS You might like to look at how Python handles pipes on Windows. As far as I know Python is bundled with an executable called 'w9xpopen.exe' which helps with interprocess communication. I might be way off the mark here though.
On Wed, 2008-12-10 at 09:12 -0800, Miller Puckette wrote:
I can imagine simply writing an example program to do this (putting some boilerplate first and then a rewritable main at the end). It would look more like this:
/* don't touch me */ .... /* but replace the following with your code */
main() { pd_startthread("arg1 arg2..."); /* do anything you want */ pd_send("foo bang;"); /* etc */ pd_endthread(); }
<snip> > Would that be a useful thing to have?
Yes, very useful! Pd 'framework' ahoy!
Jamie