X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/blobdiff_plain/798619b91c91405f847b0e48137239f218a4cf15..59f0d218a6ff34c80cf898f6d7ac62555ba8eb11:/packages/termux-api/termux-tts-speak diff --git a/packages/termux-api/termux-tts-speak b/packages/termux-api/termux-tts-speak new file mode 100755 index 00000000..e7118aac --- /dev/null +++ b/packages/termux-api/termux-tts-speak @@ -0,0 +1,34 @@ +#!/system/bin/sh + +set -u + +PARAMS="" + +SCRIPTNAME=$0 +show_usage () { + echo "usage: $SCRIPTNAME [OPTIONS]" + echo "" + echo "Speak with a device text-to-speech (TTS) engine." + echo "Find out about valid options with the device-tts-engines program." + echo " -e, --engine TTS engine to use" + echo " -l, --language language to speak in (may be unsupported by the engine)" + echo " -p, --pitch pitch to use in speech" + echo " -r, --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 SpeechReceiver $PARAMS