diff --git a/scripts/termux-tts-speak.in b/scripts/termux-tts-speak.in index bd95037..3f10067 100644 --- a/scripts/termux-tts-speak.in +++ b/scripts/termux-tts-speak.in @@ -19,12 +19,13 @@ show_usage () { echo " (2.0 is twice the normal speech rate)." echo " -s stream audio stream to use (default:NOTIFICATION), one of:" echo " ALARM, MUSIC, NOTIFICATION, RING, SYSTEM, VOICE_CALL" + echo " -o orator TTS voice to use (see termux-tts-voices)" exit 0 } PARAMS="" -while getopts :he:l:n:v:p:r:s: option +while getopts :he:l:n:v:p:r:s:o: option do case "$option" in h) show_usage;; @@ -35,6 +36,7 @@ do p) PARAMS="$PARAMS --ef pitch $OPTARG";; r) PARAMS="$PARAMS --ef rate $OPTARG";; s) PARAMS="$PARAMS --es stream $OPTARG";; + o) PARAMS="$PARAMS --es voice $OPTARG";; ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; esac done diff --git a/scripts/termux-tts-voices.in b/scripts/termux-tts-voices.in new file mode 100644 index 0000000..2cb80b1 --- /dev/null +++ b/scripts/termux-tts-voices.in @@ -0,0 +1,22 @@ +#!@TERMUX_PREFIX@/bin/sh +set -e -u + +SCRIPTNAME=termux-tts-voices +show_usage () { + echo "Usage: $SCRIPTNAME" + echo "Get information about the available text-to-speech (TTS) voice. The name of a voice may be given to the termux-tts-speak command using the -o option." + exit 0 +} + +while getopts :h option +do + case "$option" in + h) show_usage;; + ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; + esac +done +shift $((OPTIND-1)) + +if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi + +@TERMUX_PREFIX@/libexec/termux-api TextToSpeech --es voice LIST_AVAILABLE