aboutsummaryrefslogtreecommitdiff
path: root/accessibility/svox/pico2audio
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2018-06-17 22:23:45 +0100
committerDavid Spencer <idlemoor@slackbuilds.org>2018-06-17 22:23:45 +0100
commit25a8eead0087db861e96806c9dfec4b39d0fb220 (patch)
treef6482b1d2daa911375714253fbbeeeff7ae6d0bc /accessibility/svox/pico2audio
parent5bc5e45e780a49bea80ab9216f4cf8b8dd8771bc (diff)
accessibility/svox: Added (small footprint text-to-speech engine).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'accessibility/svox/pico2audio')
-rw-r--r--accessibility/svox/pico2audio61
1 files changed, 61 insertions, 0 deletions
diff --git a/accessibility/svox/pico2audio b/accessibility/svox/pico2audio
new file mode 100644
index 000000000000..4f09c8805bf9
--- /dev/null
+++ b/accessibility/svox/pico2audio
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+usage() {
+ SELF="$( basename $0 )"
+ INDT="$( echo $SELF | sed 's,., ,g' )"
+ cat <<EOF
+$SELF - wrapper for pico2wave, renders text to speech and
+$INDT plays it using the 'play' command.
+
+Written by B. Watson <yalhcru@gmail.com>, for the SlackBuilds.org project.
+Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+If a -l <language> option is given, it will be passed to pico2wave.
+
+Exit status of $SELF is that of pico2wave.
+
+Examples:
+
+ $SELF 'Hello world.'
+ Speaks "Hello world" in the default language (en-US)
+
+ $SELF -l en-GB 'Hello world.'
+ As above, in a British accent.
+
+ fortune -s | $SELF
+ Reads from standard input.
+
+ $SELF < /etc/motd
+ Speak a text file. Don't forget the < or it says the filename instead.
+EOF
+}
+
+# main()
+
+case "$1" in
+ '-?'|-h|-help|--help)
+ usage
+ exit 0
+ ;;
+ -l) LOPT="$1 $2"
+ shift
+ shift
+ ;;
+ -l?*) LOPT="$1"
+ shift
+ ;;
+esac
+
+DIR=$( mktemp -t -d pico2audio.XXXXXX )
+if [ ! -d "$DIR" ]; then
+ exit 1 # mktemp already printed an error message
+fi
+
+which pico2wave >/dev/null || exit 1
+which play >/dev/null || exit 1
+
+pico2wave $LOPT -w $DIR/tmp.wav "$@"
+E="$?"
+play -q $DIR/tmp.wav 2>/dev/null
+rm -rf $DIR
+exit "$E"