Created
January 19, 2014 16:49
-
-
Save x2q/8507414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################# | |
# Speech Script by Dan Fountain # | |
# [email protected] # | |
################################# | |
INPUT=$* | |
STRINGNUM=0 | |
ary=($INPUT) | |
echo "---------------------------" | |
echo "Speech Script by Dan Fountain" | |
echo "[email protected]" | |
echo "---------------------------" | |
for key in "${!ary[@]}" | |
do | |
SHORTTMP[$STRINGNUM]="${SHORTTMP[$STRINGNUM]} ${ary[$key]}" | |
LENGTH=$(echo ${#SHORTTMP[$STRINGNUM]}) | |
#echo "word:$key, ${ary[$key]}" | |
#echo "adding to: $STRINGNUM" | |
if [[ "$LENGTH" -lt "100" ]]; then | |
#echo starting new line | |
SHORT[$STRINGNUM]=${SHORTTMP[$STRINGNUM]} | |
else | |
STRINGNUM=$(($STRINGNUM+1)) | |
SHORTTMP[$STRINGNUM]="${ary[$key]}" | |
SHORT[$STRINGNUM]="${ary[$key]}" | |
fi | |
done | |
for key in "${!SHORT[@]}" | |
do | |
#echo "line: $key is: ${SHORT[$key]}" | |
echo "Playing line: $(($key+1)) of $(($STRINGNUM+1))" | |
mpg123 -q "http://translate.google.com/translate_tts?tl=en&q=${SHORT[$key]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment