Created
April 24, 2018 01:26
-
-
Save neildaemond/718c056cbd3c457da23b68f4ae365248 to your computer and use it in GitHub Desktop.
text_to_voice.sh
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 | |
## this script is based on: | |
## https://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis) | |
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$1&tl=en"; } | |
recorded=("Step One. go to the box in the corner", | |
"Step Two. input a template name") | |
recorded_length=${#recorded[@]} | |
if [ $1 == "recorded" ] | |
then | |
spot=0 | |
while [ $spot -lt $recorded_length ] | |
do | |
echo "${recorded[$spot]}" | |
read nothing | |
say "${recorded[$spot]}" | |
((spot++)) | |
done | |
fi | |
echo "Input text to be converted to speech, followed by [ENTER]" | |
while true | |
do | |
read input_text | |
say "$input_text" | |
done | |
## to exit, use key combo: [ctrl + x ][ ctrl + c ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment