Closed Samuraiwarm closed 4 years ago
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 ttytr
removes the visual blockssed
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^)/
I'm trying to integrate
doge
withespeak
, 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.Is there a way to output both the original doge and the speech of doge's output?