curl: Update from 7.48 to 7.49
[termux-packages] / packages / termux-api / termux-tts-speak
CommitLineData
cc1ae02e 1#!/bin/sh
3b43db5d 2set -e -u
59f0d218 3
3b43db5d 4SCRIPTNAME=termux-tts-speak
59f0d218 5show_usage () {
bea93fbd
FF
6 echo "Usage: $SCRIPTNAME [-e engine] [-l language] [-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 " -p pitch pitch to use in speech. 1.0 is the normal pitch,"
12 echo " lower values lower the tone of the synthesized voice,"
13 echo " greater values increase it."
14 echo " -r rate speech rate to use. 1.0 is the normal speech rate,"
15 echo " lower values slow down the speech"
16 echo " (0.5 is half the normal speech rate)"
17 echo " while greater values accelerates it"
18 echo " (2.0 is twice the normal speech rate)."
19 echo " -s stream audio stream to use (default:NOTIFICATION), one of:"
20 echo " ALARM, MUSIC, NOTIFICATION, RING, SYSTEM, VOICE_CALL"
21 echo ""
22 exit 0
59f0d218
FF
23}
24
3b43db5d
FF
25PARAMS=""
26
bea93fbd 27while getopts :he:l:p:r:s: option
3b43db5d 28do
bea93fbd
FF
29 case "$option" in
30 h) show_usage;;
31 e) PARAMS="$PARAMS --es engine $OPTARG";;
32 l) PARAMS="$PARAMS --es language $OPTARG";;
33 p) PARAMS="$PARAMS --ef pitch $OPTARG";;
34 r) PARAMS="$PARAMS --ef rate $OPTARG";;
35 s) PARAMS="$PARAMS --es stream $OPTARG";;
36 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
37 esac
59f0d218 38done
3b43db5d
FF
39shift $(($OPTIND-1))
40
41CMD="@TERMUX_API@ TextToSpeech $PARAMS"
42if [ $# = 0 ]; then
bea93fbd 43 $CMD
3b43db5d 44else
bea93fbd 45 echo $@ | $CMD
3b43db5d 46fi
59f0d218 47