[PD] get console messages within patch

tim vets timvets at gmail.com
Thu Nov 17 09:53:07 CET 2011


2011/11/17 IOhannes m zmoelnig <zmoelnig at iem.at>

> -----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:
> - - take the output of Pd, and send it (using pdsend) to port 9999 of the
> 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
>
>
> How do I get past "send: Connection refused (111)"?

gr,
Tim

>
>
> [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
> >> --
> >
> >
> >
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk7ExbcACgkQkX2Xpv6ydvQVrgCgqNEW7N3V8vWSk8M01MLpDr22
> jVcAoIFKLeGVp/g3+gV6K1wm4KuYH+Ri
> =0WOh
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111117/eefd24f5/attachment.htm>


More information about the Pd-list mailing list