wow such text-to-speech much help needed wow
Samuraiwarm opened this issue · 2 comments
Samuraiwarm commented
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?
wwmoraes commented
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) [usesunbuffer
from theexpect
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, soecho -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 🎉
Samuraiwarm commented
Holy doge that works perfectly! Wow such thancc much doge! \(^o^)/