nodejs: Update from 5.10.1 to 5.11.0
[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 () {
3b43db5d 6 echo "Usage: $SCRIPTNAME [OPTIONS] <text-to-speak>"
3a8f9cc4 7 echo "Speak stdin input with a system text-to-speech (TTS) engine."
3b43db5d
FF
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 (0.5 is half the normal speech rate),"
16 echo " greater values accelerate it ({@code 2.0} is twice the normal speech rate)."
17 echo ""
18 echo "The text to send can be specified either as arguments or on stdin if no arguments are given."
19 exit 0
59f0d218
FF
20}
21
3b43db5d
FF
22PARAMS=""
23
24while getopts :he:l:p:r: option
25do
26 case "$option" in
27 h) show_usage;;
28 e) PARAMS="$PARAMS --es engine $OPTARG";;
29 l) PARAMS="$PARAMS --es language $OPTARG";;
30 p) PARAMS="$PARAMS --ef pitch $OPTARG";;
31 r) PARAMS="$PARAMS --ef rate $OPTARG";;
32 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
33 esac
59f0d218 34done
3b43db5d
FF
35shift $(($OPTIND-1))
36
37CMD="@TERMUX_API@ TextToSpeech $PARAMS"
38if [ $# = 0 ]; then
39 $CMD
40else
41 echo $@ | $CMD
42fi
59f0d218 43