talkii 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #! /bin/bash
  2. echo "talkii usage: talkii <chandirhere>"
  3. #making sure we dont just repeat the line indefinitely...
  4. last_line=""
  5. while true; do
  6. current_line=$(tail -n1 "$1/out" | cut -d ' ' -f 2-)
  7. if [[ "$current_line" != "$last_line" && -n "$current_line" ]]; then
  8. #here we output, and play with mpv, more reliable, more options, then playing direct through flite.
  9. echo "$current_line" | flite -o /tmp/talkii_audio.wav
  10. mpv --no-terminal --speed=1.5 --no-cache /tmp/talkii_audio.wav
  11. last_line="$current_line"
  12. fi
  13. sleep 1
  14. done
  15. #future fiitures:
  16. # talkii plays different voice per nick
  17. # the old original initial (pseudo)code idea outline, saved here for posterity:
  18. # #echo "talkii usage: talkii <chandirhere>"
  19. # #templine:
  20. # echo "run flite -l -f talk"
  21. # #the gist of what i want
  22. # #tail -n1 out | flite -t $1
  23. # # this works... sorta.
  24. # #with
  25. # #flite -l -f talk
  26. # #also running
  27. # watch -n1 -g stat -f out ;and tail -n1 out > talk ;and sleep 1 ;and echo > talk
  28. # talkii
  29. # #this "works".
  30. # #as in, it wont loop saying the whole of everything forever, and no need to wipe the out file.
  31. # #it's very janky and unreliable, but gets me to the next ballpark of development n cleaning this up to work cleaner, smarter, better.
  32. # ### so.... seriously this is jaaaaaank. janky janky. so many holes it wont catch. so, need to tighten it up, n get it such that it wont freak out, wont repeat things, wont miss things, wont need 2 commands running for it (get the flite into it)