-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-11-17 02:25, Vincent Kaschner wrote:
As a beginner in Pd, I'm also wondering what that means...
Hey IOhannes,
thank you, but could you please explain it a bit more in detail? I am not a complete newbie, but not so much into the pd-list speak. I searched in the list for the question, but there was no comprehensible solution shown... It's on pd extended 0.42.5 on Win XP.
sorry for talking gibberish.
i don't know much about Pd-extended and little about w32. i'll give it a try though:
$ pd -stderr 2>&1 | pdsend 9999 localhost udp
this basically means:
local machine.
the 2nd part of the line ("pdsend 9999 localhost udp") should be fairly obvious: it calls the pdsend program (on w32 it is called pdsend.exe and you might have to find out where it is - somewhere in the Pd\bin\ folder is a good guess), with some parameters, that specify the target port (9999), the target host (localhost, the machine the program is executed on) and the protocol (udp).
the 1st part is a bit more complicated, i'll come to it later. it basically grabs all messages printed by Pd.
the fun part is in the middle, "|" (aka 'pipe') takes the "output" of one program (in this case Pd) and uses it as "input" to another program (here: pdsend)
the slightly unorthodox part is the 1st one: we have to make Pd produce it's output in a form that is usable as input for pdsend. this basically means that instead of sending the printout to the pd-console, we have to redirect it to a special output, that is called "stdout" (pdsend will read from "stdin", and the pipe ("|") will magically transform the stdout of the 1st program to the stdin of the 2nd; see [1] for more information) Pd usually send s it output to the Pd-console. however, you can start it with a special cmdline flag, that will all messages to a special output, the "stderr" (see [1] again). if you start Pd from the console (the cmdline; on w32 this would be e.g. the "cmd" program), all messages sent to the stderr will show up on the console (note, that on w32 you will have to start pd.com rather than pd.exe, because else windows will prevent the stderr to be printed to the console). this is almost what we want (we are sending Pd's printout to some standard stream!), but we are not there yet (Pd sends to "stderr", whereas we want it to send to "stdout")
luckily enough, many cmdline interpreters have a special syntax for redirecting stdstreams. on bash (a common cmdline interpreter on un*x) and afaik on w32, you can do redirect the stderr of a program to the stdout using "2>&1" (stderr has a numeric file descriptor 2; stdout has a numeric file descriptor 1; so this redirection means: take filedescriptor 2 (stderr) and send it to filedescriptor 1 (stdout))
so the line i gave means: "pd" - start Pd, "-stderr" - but send all printout to stderr rather than the pdconsole "2>&1" - then redirect the stderr to stdout, "|" - pipe the stdout to the stdin "pdsend ..." - of pdsend, which will send the data (back to Pd)
hope that helps.
fgamrt IOhannes
[1] http://en.wikipedia.org/wiki/Standard_streams
best mirro
Hi list,
I wonder if there is a possibility to receive console messages within a
patch. Could be helpful, for instance, when there is a certain error that should immediately trigger a reaction.
Thanks for advice.
i guess there are some answers for that in the archives.
the simplest is probably still $ pd -stderr 2>&1 | pdsend 9999 localhost udp
and then have [netreceive 9999 1] listen for your output.
fgmasdr IOhannes --