curl: Update from 7.51.0 to 7.52.0
[termux-packages] / packages / termux-api / termux-tts-speak
1 #!/bin/sh
2 set -e -u
3
4 SCRIPTNAME=termux-tts-speak
5 show_usage () {
6 echo "Usage: $SCRIPTNAME [-e engine] [-l language] [-n region] [-v variant] [-p pitch] [-r rate] [-s stream] [text-to-speak]"
7 echo "Speak text with a system text-to-speech (TTS) engine. The text to speak is either supplied as arguments or read from stdin if no arguments are given."
8 echo ""
9 echo " -e engine TTS engine to use (see termux-tts-engines)"
10 echo " -l language language to speak in (may be unsupported by the engine)"
11 echo " -n region region of language to speak in"
12 echo " -v variant variant of the language to speak in"
13 echo " -p pitch pitch to use in speech. 1.0 is the normal pitch,"
14 echo " lower values lower the tone of the synthesized voice,"
15 echo " greater values increase it."
16 echo " -r rate speech rate to use. 1.0 is the normal speech rate,"
17 echo " lower values slow down the speech"
18 echo " (0.5 is half the normal speech rate)"
19 echo " while greater values accelerates it"
20 echo " (2.0 is twice the normal speech rate)."
21 echo " -s stream audio stream to use (default:NOTIFICATION), one of:"
22 echo " ALARM, MUSIC, NOTIFICATION, RING, SYSTEM, VOICE_CALL"
23 echo ""
24 exit 0
25 }
26
27 PARAMS=""
28
29 while getopts :he:l:n:v:p:r:s: option
30 do
31 case "$option" in
32 h) show_usage;;
33 e) PARAMS="$PARAMS --es engine $OPTARG";;
34 l) PARAMS="$PARAMS --es language $OPTARG";;
35 n) PARAMS="$PARAMS --es region $OPTARG";;
36 v) PARAMS="$PARAMS --es variant $OPTARG";;
37 p) PARAMS="$PARAMS --ef pitch $OPTARG";;
38 r) PARAMS="$PARAMS --ef rate $OPTARG";;
39 s) PARAMS="$PARAMS --es stream $OPTARG";;
40 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
41 esac
42 done
43 shift $(($OPTIND-1))
44
45 CMD="@TERMUX_API@ TextToSpeech $PARAMS"
46 if [ $# = 0 ]; then
47 $CMD
48 else
49 echo $@ | $CMD
50 fi
51