termux-packages/packages/termux-api/termux-tts-speak

34 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2015-06-13 01:03:31 +02:00
set -u
PARAMS=""
show_usage () {
echo "usage: termux-tts-speak [OPTIONS]"
2015-06-13 01:03:31 +02:00
echo ""
echo "Speak stdin input with a system text-to-speech (TTS) engine."
echo "Find out about available engines by executing 'termux-tts-engines'."
2015-06-13 01:03:31 +02:00
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