0

I am not getting the command pipe to work for say and spd-say. Specifically, I want to pipe the output of fortune to spd-say, which seems more advanced than say. I tried the usual pipe construction

fortune | spd-say

Other commands do work, like

fortune | wc

Apparently, the speech dispatcher commands treat the piped input different from the ordinary arguments. I would like to fix this and understand what is going on.

1 Answers1

2

Use option -e / --pipe-mode to read the text from stdin and process it. This also outputs the text to stdout.

$ fortune | spd-say -e
Don't feed the bats tonight.

Please read the info manual (info spd-say) which contains a few examples.

Freddy
  • 25,172
  • 1
  • 21
  • 60
  • Quick side notes: if you have some kind of situation like: `echo $PRE_COLLECTED_INFO_MESSAGE ` make sure to put that variable in double quotes like: `echo "$PRE_COLLECTED_INFO_MESSAGE"` especially if it potentially has newlines or punctuation in it. Otherwise some of the content may get "lost" before it makes it into spd-say. Also: if content is long, include the --wait parameter. Otherwise it might just quit in the middle of the sentence. – Justin Sep 14 '22 at 16:02