Olivia5k/doge

wow such text-to-speech much help needed wow

Samuraiwarm opened this issue · 2 comments

I'm trying to integrate doge with espeak, the text to speech synthesizer.

Attempts so far:

  • doge | espeak only outputs the speech, but no doge ;(
  • doge && doge | espeak does output both doge and speech, but the speech is different from the doge text.
  • below commands doesn't display colored text and the doge ;(
OUTPUT="`doge`"
printf "${OUTPUT}"
espeak "${OUTPUT}"

Is there a way to output both the original doge and the speech of doge's output?

bash: unbuffer doge | tee /dev/tty | tr -d "▄▀" | sed -e $'s/\033\[[0-9;]*m//g' | awk 'NF==0{next};{$1=$1};{print $0";"}' | espeak

fish: unbuffer doge | tee /dev/tty | tr -d "▄▀" | sed -e (echo -e 's/\033\[[0-9;]*m//g') | awk 'NF==0{next};{$1=$1};{print $0";"}' | espeak

This long pipe will:

  • unbuffer doge output (prevent parsing the control escapes) [uses unbuffer from the expect package]
  • tee outputs to stdout (i.e. echo/print normally) and pipes it back to tty
  • tr removes the visual blocks
  • sed removes control sequences (also note the $'' - that's a bash'ism to translate the \033 so sed gets the correct escape character - on fish it doesn't exist, so echo -e is needed)
  • awk removes empty lines, extra space and adds a ";" to the end of each line (that adds a pause on the speak, otherwise some mechanisms speak everything as a single sentence)
  • espeak speaks as expected, wow 🎉

Holy doge that works perfectly! Wow such thancc much doge! \(^o^)/