Skip to content

Add script to see tts voices, add voice option #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/termux-tts-speak.in
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand All @@ -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
Expand Down
22 changes: 22 additions & 0 deletions scripts/termux-tts-voices.in
Original file line number Diff line number Diff line change
@@ -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