[PD] looking for a way to execute a program from pd

Claude Heiland-Allen claudiusmaximus at goto10.org
Sat Mar 22 21:49:37 CET 2008


An alternative method that I like for asynchronous execution is:

[netsend]
[netreceive] -- optional, for knowing when the command has completed

and a bash script like:

#!/bin/bash
pdreceive ... |
while read line
do
   somecommand "$LINE" >/dev/null
   echo "done;" # optional
done |         # optional (pipe)
pdsend ...     # optional


pdsend and pdreceive are little tools provided with Pd to interact with 
netsend and netreceive.

A concrete example:

----8<----
#!/bin/bash
pdreceive 1570 |
while read line ; do
     ppmhist -map <histogram-in.ppm >histogram-tmp.ppm
     ppmtoppm <histogram-tmp.ppm >histogram-out.ppm
     echo "ready ;"
done |
pdsend 1571
----8<----

The Pd patch uses GridFlow to save histogram-in.ppm and sends "go" to 
netsend, which executes one run through the loop, then when Pd 
netreceive receives "ready", it loads histogram-out.ppm and carries on 
processing - hopefully GridFlow will get histogram support soon, if it 
doesn't already.


Claude

Andrew Turley wrote:
> It looks like that should work. Thanks.
> 
> andy
> 
> On Sat, Mar 22, 2008 at 12:43 PM, Hans-Christoph Steiner <hans at eds.org> wrote:
>>  [shell] and [popen] should work.
>>
>>  .hc
>>
>>
>>
>>  On Mar 22, 2008, at 2:09 PM, Andrew Turley wrote:
>>
>>  > Hey, I was wondering if there was a way to execute a program from pd.
>>  > Specifically, I would like to use the osascript command in Mac OS X to
>>  > send a command to iTunes.
>>  >
>>  > I can write an external to do this, but if there is already something
>>  > out there to do then then I will use that.
>>  >
>>  > andy
>>  >
>>  > _______________________________________________
>>  > PD-list at iem.at mailing list
>>  > UNSUBSCRIBE and account-management -> http://lists.puredata.info/
>>  > listinfo/pd-list
>>
>>
>>
>>  ------------------------------------------------------------------------
>>  ----
>>
>>  The arc of history bends towards justice.     - Dr. Martin Luther
>>  King, Jr.
>>
>>
>>
> 
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

-- 
http://claudiusmaximus.goto10.org




More information about the Pd-list mailing list