Hi list,
I am trying to execute shell commands from withing pd using the FUDI protocoll and the command line programs pdsend and pdreceive. I want to trigger the espeak command from within pd. On Debian it already works using pdreceive 8888 udp | espeak and sending words to speak as a message to [netsend -u] in a Pd patch.
Now espeak has nice flags, such as the -p 50 flag for pitch. I would like to send this from pd as well and am now sending the command itself to pdreceive as pdreceive 8888 udp | sh and a Pd message containing send espeak -p 20 "blah blah blah" which works as well.
Is there a way I can let pd know that the command has finished executing? For example by sending something back like pdreceive 8888 udp | sh - ; echo "done" | pdsend 8889 localhost udp which sadly does not work?
I would also like to spawn multiple espeak commands in parallel from one [netsend] using this approach but can't seem to make it work. Again using the command pdreceive 8888 udp | sh and including an ampersand at the end of the Pd message like send espeak -p 20 "blah blah blah" & throws a sh: 1: Syntax error: ";" unexpected error on the shell terminal with pdreceive exiting.
Does anyone have an idea what I can try here (except for writing a wrapper script)?
Thank you for all ideas! P
On Mon, 2021-09-06 at 21:51 +0200, Peter P. wrote:
Is there a way I can let pd know that the command has finished executing? For example by sending something back like pdreceive 8888 udp | sh - ; echo "done" | pdsend 8889 localhost udp which sadly does not work?
pdreceive won't exit, no matter if espeak is done or not. Slightly modifying your attempt to send it to the background solves the report back problem for me:
[send espeak "blah blah blah" && echo done | pdsend 9999 localhost udp( | [netsend -u]
[netreceive -u 9999]
works with this command:
pdreceive 8888 udp | sh
I would also like to spawn multiple espeak commands in parallel from one [netsend] using this approach but can't seem to make it work. Again using the command pdreceive 8888 udp | sh and including an ampersand at the end of the Pd message like send espeak -p 20 "blah blah blah" & throws a sh: 1: Syntax error: ";" unexpected error on the shell terminal with pdreceive exiting.
I don't know how to do this with only one [netsend]/pdreceive pair. If you can use many pairs, you can use above approach to detect when an individual instance is done for reuse.
Does anyone have an idea what I can try here (except for writing a wrapper script)?
Thank you for all ideas!
I wish doing such things would be easier in Pd. pdsend and pdreceive give you some flexibility, but require that you actively initiate the command first.
I was hoping I could improve the situation with the [command]¹ external, but fail miserably. 'exec espeak hello my name is roman' plays only 'hello'. When I use a symbol box to write the text, the backslash escapes for the whitespaces are passed to espeak and the result is 'hello backslash my backslash is [...]'. At least, it reports correctly when the command has finished. If the external could be made work correctly, it would be easier to run many instances of your idea and also you wouldn't need any interaction outside of Pd, but unfortunately we're not there yet.
Roman