34 lines
1.0 KiB
Bash
Executable File
34 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -u
|
|
|
|
PARAMS=""
|
|
|
|
show_usage () {
|
|
echo "usage: termux-tts-speak [OPTIONS]"
|
|
echo ""
|
|
echo "Speak stdin input with a system text-to-speech (TTS) engine."
|
|
echo "Find out about available engines by executing 'termux-tts-engines'."
|
|
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
|