Twitter Espeak

What if my tweets can be heard

Install rainbowstream

rainbowstream is a twitter client for linux cli.

  • prepare python venv
python3 -m venv venv
source venv/bin/activate
  • install rainbowstream
pip install rainbowstream
  • run rainbowstream
rainbowstream
# you will be asked to login to twitter

Install espeak

espeak is TTS software for linux

sudo apt install espeak

test espeak can speak

espeak hello
espeak "한글"
echo "hello" | espeak

Prepare text stream

I will create temporary PIPE file that will pass the texts from rainbowstream to espeak

mkfifo /tmp/sock

Run read and speaker

espeak will listen on /tmp/sock for text

#!/bin/bash

test -e /tmp/rainbowsream || mkfifo /tmp/rainbowstream

while true
do
espeak < /tmp/rainbowstream
done

Run rainbowstream and feed texts

run rainbowstream in text only mode

rainbowstream | sed -u -e 's/\x1b\[[0-9;]*m//g' | tee /tmp/sock
  • sed will remove color code
  • tee will pass text to the PIPE and will print out too
  • you can remove additional unnecessary text via sed or grep. I uses grep --line-buffered -v "id:[0-9]+ via"