You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

10 years ago
#!/system/bin/sh
set -u
PARAMS=""
show_usage () {
echo "usage: termux-tts-speak [OPTIONS]"
10 years ago
echo ""
echo "Speak stdin input with a system text-to-speech (TTS) engine."
echo "Find out about available engines by executing 'termux-tts-engines'."
10 years ago
echo " -e, --engine <engine> TTS engine to use"
echo " -l, --language <language> language to speak in (may be unsupported by the engine)"
echo " -p, --pitch <pitch> pitch to use in speech"
echo " -r, --rate <rate> rate to use in speech"
}
O=`busybox getopt -q -l engine: -l help -l language: -l pitch: -l rate: -- e:hl:p:r: "$@"`
if [ $? != 0 ] ; then show_usage; exit 1 ; fi
eval set -- "$O"
while true; do
case "$1" in
-e|--engine) PARAMS="$PARAMS --es engine $2"; shift 2;;
-l|--language) PARAMS="$PARAMS --es language $2"; shift 2;;
-p|--pitch) PARAMS="$PARAMS --ef pitch $2"; shift 2;;
-r|--rate) PARAMS="$PARAMS --ef rate $2"; shift 2;;
-h|--help) show_usage; exit 0;;
--) shift; break;;
*) echo Error; exit 1;;
esac
done
termux-api TextToSpeech $PARAMS