LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to make everything on stdout be read aloud (using eSpeak)? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-make-everything-on-stdout-be-read-aloud-using-espeak-4175461707/)

jmite 05-13-2013 01:40 AM

How to make everything on stdout be read aloud (using eSpeak)?
 
I've got the eSpeak TTS system up and running, and I like it quite a bit.

I'm wondering, is there a way to pipe EVERYTHING that gets printed to STDOUT to espeak? I'm trying to set up a system without a monitor that would speak the terminal output to me.

I've found the brltty-espeak package, but I have no idea how to set it up.

pan64 05-13-2013 01:59 AM

I do not know this eSpeak system, but I know every terminal has its own stdout and probably you do not really need all the stdouts, just some specific one. The normal approach is to attach TTS to a given terminal.
Based on the documentation you need to redirect stdout to espeak

jmite 05-13-2013 09:41 AM

Okay then, how do I redirect stdout to espeak? It seems to take normal pipe input like any other program, but how do I direct all of stdout on a terminal to espeak?

schneidz 05-13-2013 09:50 AM

Code:

echo hello world | espeak
i tired this but it is kinda buggy:
Code:

cat  /dev/pts/1 | espeak

jmite 05-13-2013 10:26 AM

Is there a way to pipe every command to espeak without having to manually type it each time? My goal is to have a computer without a monitor which will read everything on stdout to me.

pan64 05-14-2013 12:33 AM

yes, there is a way (several ways). Actually I have no espeak, so I cannot test it, but in general it should work:
Code:

#you can create a fifo
ESPEAK_FIFO=/tmp/espeak_fifo
mkfifo $ESPEAK_FIFO
# start espeak in the background
espeak -f $ESPEAK_FIFO &
# or use tee to keep text on display too
cat $ESPEAK_FIFO | tee /dev/tty | espeak
# redirect stdout to fifo
exec >$ESPEAK_FIFO

this small script should be sourced in your terminal and afterwards everything displayed will be sent to espeak.


All times are GMT -5. The time now is 05:35 AM.