Advertisement
mesmariusz

text2speech_pl.sh

Apr 26th, 2016
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. INPUT=$*
  4. STRINGNUM=0
  5. ary=($INPUT)
  6. for key in "${!ary[@]}"
  7. do
  8. SHORTTMP[$STRINGNUM]="${SHORTTMP[$STRINGNUM]} ${ary[$key]}"
  9. LENGTH=$(echo ${#SHORTTMP[$STRINGNUM]})
  10. if [[ "$LENGTH" -lt "100" ]]; then
  11. SHORT[$STRINGNUM]=${SHORTTMP[$STRINGNUM]}
  12. else
  13. STRINGNUM=$(($STRINGNUM+1))
  14. SHORTTMP[$STRINGNUM]="${ary[$key]}"
  15. SHORT[$STRINGNUM]="${ary[$key]}"
  16. fi
  17. done
  18. for key in "${!SHORT[@]}"
  19. do
  20. say() { local IFS=+;/usr/bin/X11/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=pl&q=${SHORT[$key]}&ie=UTF-8&total=1&idx=0&client=t"; }
  21. say $*
  22. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement