accessibility/espeak: Add pulseaudio, make portaudio optional.

Signed-off-by: B. Watson <yalhcru@gmail.com>
This commit is contained in:
B. Watson 2019-12-19 05:05:20 -05:00 committed by Willy Sudiarto Raharjo
parent baaff0cb30
commit a399bd9fe5
No known key found for this signature in database
GPG key ID: 887B8374D7333381
6 changed files with 134 additions and 77 deletions

View file

@ -6,14 +6,30 @@ quite different. It's perhaps not as natural or "smooth", but some find
the articulation clearer and easier to listen to for long periods. It
can run as a command line program to speak text from a file or from stdin.
To build without portaudio support, set WAVONLY=yes in the script's
environment.
Build options (environment variables):
If you get errors like this:
PULSE Build PulseAudio output support (yes/no)? Default is "yes".
bt_audio_service_open: connect() failed: Connection refused (111)
PORTAUDIO Build PortAudio output support (yes/no/auto)? Default is "auto",
which will build in PortAudio support if it's installed.
...either ignore them (if espeak produces audio anyway), or comment out
the 'pcm.headset' and 'ctl.headset' stanzas in /etc/asound.conf. This
should only happen if your Slackware system was upgraded from an older
version.
Use PortAudio[1] for plain ALSA[2] audio output, if you don't want to use
PulseAudio. However, if you're happy with PulseAudio, it's recommended NOT
to build PortAudio support into espeak (you won't need it anyway).
Note that if both options are "no" (or if PULSE=no and portaudio isn't
autodetected), the resulting binary will not be able to make sound
(it will only produce .wav files).
The slack-desc will be updated to let you know which audio drivers
(if any) were included.
[1] Using PortAudio with espeak results in a lot of scary-looking
warnings from espeak, but you can ignore them so long as you
can hear its speech.
[2] Or JACK audio, if your portaudio package was built with jack2 or
jack-audio-connection-kit installed. Or... PortAudio can also feed
audio to PulseAudio, if its daemon is running. Or, if you have OSS
modules loaded, PortAudio can use that, too. The Linux audio driver
ecosystem is a really weird place.

View file

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH ESPEAK 1 "June 23, 2006"
.TH ESPEAK 1 "August 6, 2010"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -16,7 +16,7 @@
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
espeak \- A multi-lingual software speech synthesizer.
espeak \- A multi\-lingual software speech synthesizer.
.SH SYNOPSIS
.B espeak
.RI [ options ]\ [ "<words>" ]
@ -28,59 +28,89 @@ is a software speech synthesizer for English, and some other languages.
.B \-h
Show summary of options.
.TP
.B \-\-version
Prints the espeak library version and the location of the espeak voice data.
.TP
.B \-f <text file>
Text file to speak
.TP
.B \-\-stdin
Read text input from stdin instead of a file
.TP
If neither -f nor --stdin, <words> are spoken, or if none then text is spoken from stdin, each line separately.
If neither \-f nor \-\-stdin, <words> are spoken, or if none then text is spoken from stdin, each line separately.
.TP
.B \-q
Quiet, don't produce any speech (may be useful with -x)
Quiet, don't produce any speech (may be useful with \-x)
.TP
.B \-a <integer>
Amplitude, 0 to 20, default is 10
Amplitude, 0 to 200, default is 100
.TP
.B \-g <integer>
Word gap. Pause between words, units of 10mS at the default speed
.TP
.B \-k <integer>
Indicate capital letters with: 1=sound, 2=the word "capitals", higher values = a pitch increase (try \-k20).
.TP
.B \-l <integer>
Line length. If not zero (which is the default), consider
lines less than this length as and-of-clause
lines less than this length as and\-of\-clause
.TP
.B \-p <integer>
Pitch adjustment, 0 to 99, default is 50
.TP
.B -s <integer>
peed in words per minute, default is 160
Speed in words per minute, default is 160
.TP
.B \-v <voice name>
Use voice file of this name from espeak-data/voices
.TP
.B -m
Indicates that the text contains SSML (Speech Synthesis Markup Language) tags or other XML tags. Those SSML tags which are supported are interpreted. Other tags, including HTML, are ignored, except that some HTML tags such as <hr> <h2> and <li> ensure a break in the speech.
Use voice file of this name from espeak\-data/voices
.TP
.B \-w <wave file name>
Write output to this WAV file, rather than speaking it directly
.TP
.B -b
Input text encoding, 1=UTF8, 2=8 bit, 4=16 bit
.TP
.B -m
Indicates that the text contains SSML (Speech Synthesis Markup Language) tags or other XML tags. Those SSML tags which are supported are interpreted. Other tags, including HTML, are ignored, except that some HTML tags such as <hr> <h2> and <li> ensure a break in the speech.
.TP
.B \-x
Write phoneme mnemonics to stdout
.TP
.B \-X
Write phonemes mnemonics and translation trace to stdout
Write phonemes mnemonics and translation trace to stdout. If rules files have been built with --compile=debug, line numbers will also be displayed.
.TP
.B \-z
No final sentence pause at the end of the text
.TP
.B \-\-stdout
Write speech output to stdout
.TP
.B \-\-compile=<voice name>
.B \-\-compile=voicename
Compile the pronunciation rules and dictionary in the current directory. =<voice name> is optional and specifies which language
.TP
.B \-\-compile=debug
Compile the pronunciation rules and dictionary in the current directory as above, but include line numbers, that get shown when -X is used.
.TP
.B \-\-ipa
Write phonemes to stdout using International Phonetic Alphabet. --ipa=1 Use ties, --ipa=2 Use ZWJ, --ipa=3 Separate with _
.TP
.B \-\-path=<path>
Specifies the directory containing the espeak-data directory
.TP
.B \-\-pho
Write mbrola phoneme data (.pho) to stdout or to the file in --phonout
.TP
.B \-\-phonout=<filename>
Write output from -x -X commands and mbrola phoneme data to this file
.TP
.B \-\-punct="<characters>"
Speak the names of punctuation characters during speaking. If =<characters> is omitted, all punctuation is spoken.
.TP
.B \-k <integer>
Indicate capital letters with: 1=sound, 2=the word "capitals", higher values = a pitch increase (try -k20).
.TP
.B \-\-voices[=<language code>]
Lists the available voices. If =<language code> is present then only those voices which are suitable for that language are listed.
.TP
.B \-\-voices=<directory>
lists the voices in the specified subdirectory.
.SH AUTHOR
eSpeak was written by Jonathan Duddington <jonsd@jsd.clara.co.uk>. The webpage for this package can be found at http://espeak.sourceforge.net/.
.PP

View file

@ -6,9 +6,18 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20191218 bkw:
# - BUILD=2
# - Update man page (still using the one from Debian).
# - It turns out espeak supports PulseAudio, so that's now the default.
# - Remove portaudio from REQUIRES.
# - Add PULSE and PORTAUDIO environment variables, update README.
# - Simplify the script (unfortunately it had to get more complex
# again to support the new variables).
PRGNAM=espeak
VERSION=${VERSION:-1.48.04}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -40,63 +49,82 @@ fi
set -e
# Support old WAVONLY variable, but don't mention it in README.
if [ "${WAVONLY:-no}" = "yes" ]; then
PULSE=no
PORTAUDIO=no
fi
# Preemptively support -current's pure-alsa-system: if pulseaudio's
# not installed (it normally is on 14.2), just build without it.
PULSE="${PULSE:-yes}"
pkg-config --exists libpulse || PULSE=no
case "${PORTAUDIO:-auto}" in
yes) if ! pkg-config --exists portaudio-2.0; then
cat <<EOF
You've requested portaudio support via PORTAUDIO=yes, but portaudio
is not installed. Sorry.
EOF
exit 1
fi ;;
no) ;;
*) pkg-config --exists portaudio-2.0 && PORTAUDIO=yes || PORTAUDIO=no ;;
esac
if [ "$PORTAUDIO" = "yes" ] && [ "$PULSE" = "yes" ]; then
AUDIO=runtime
DRIVERS="portaudio and pulseaudio"
elif [ "$PORTAUDIO" = "yes" ]; then
AUDIO=portaudio
DRIVERS="$AUDIO"
elif [ "$PULSE" = "yes" ]; then
AUDIO=pulseaudio
DRIVERS="$AUDIO"
else
AUDIO=none
DRIVERS="none (.wav file output only)"
fi
echo "=== PULSE=$PULSE PORTAUDIO=$PORTAUDIO AUDIO=$AUDIO"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-source
unzip $CWD/$PRGNAM-$VERSION-source.zip
unzip $CWD/$PRGNAM-$VERSION-source.zip -x '*/linux_32bit/*' '*/platforms/*'
cd $PRGNAM-$VERSION-source
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Cruft...
find . -type d -a -name .svn -print0 | xargs -0 rm -rf
# Make the Makefile install everything stripped
patch -p1 < $CWD/makefile.patch
# Permissions are bletcherous, reset them all.
find -L . \( -type d -a -exec chmod 755 {} + \) -o \
\( -type f -a -exec chmod 644 {} + \)
# Note: there are two executables (speak and espeak). They seem to do the same
# thing, except "speak" doesn't use libespeak.so at runtime. This package only
# installs "espeak" (which is how other distros do it, too).
# The LDFLAGS="-Wl,-s" makes gcc strip the binaries for us.
cd src
if [ "${WAVONLY:-no}" = "yes" ]; then
EXTRAMAKEFLAGS="AUDIO=none"
else
# Let this script die due to "set -e" if no portaudio installed...
pkg-config --modversion portaudio-2.0
# portaudio version *should* be 19, but support 18 just in case...
rm -f portaudio.h
ln -s portaudio$( pkg-config --modversion portaudio-2.0 ).h portaudio.h
fi
rm -f portaudio.h # use system-wide header!
LIBDIR=/usr/lib$LIBDIRSUFFIX
SLKCFLAGS="$SLKCFLAGS -Wno-narrowing"
make LIBDIR=/usr/lib$LIBDIRSUFFIX CXXFLAGS="$SLKCFLAGS" $EXTRAMAKEFLAGS
make install LIBDIR=/usr/lib$LIBDIRSUFFIX DESTDIR=$PKG $EXTRAMAKEFLAGS
rm -f $PKG/usr/lib$LIBDIRSUFFIX/*.a # guidelines say no static libs
find $PKG/usr/share -type f -print0 | xargs -0 chmod 644
make LDFLAGS="-Wl,-s" LIBDIR=$LIBDIR CXXFLAGS="$SLKCFLAGS" AUDIO="$AUDIO"
make install LIBDIR=$LIBDIR DESTDIR=$PKG
rm -f $PKG/$LIBDIR/*.a # guidelines say no static libs
cd ..
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -r ReadMe *.txt docs/* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 0644 {} \;
# Man page from Debian
mkdir -p $PKG/usr/man/man1
gzip -9c $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
if [ "${WAVONLY:-no}" = "yes" ]; then
sed -i \
'19s/:/: This package lacks audio support (wav file output only)/' \
$PKG/install/slack-desc
fi
sed "s,@DRIVERS@,$DRIVERS," \
$CWD/slack-desc \
> $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -5,6 +5,6 @@ DOWNLOAD="http://downloads.sourceforge.net/espeak/espeak-1.48.04-source.zip"
MD5SUM="cadd7482eaafe9239546bdc09fa244c3"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="portaudio"
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -1,17 +0,0 @@
diff -Naur espeak-1.44.05-source/src/Makefile espeak-1.44.05-source.patched/src/Makefile
--- espeak-1.44.05-source/src/Makefile 2010-08-13 17:35:09.000000000 -0400
+++ espeak-1.44.05-source.patched/src/Makefile 2010-12-26 19:31:55.000000000 -0500
@@ -113,11 +113,9 @@
$(MKDIR) $(DESTDIR)$(INCDIR)
$(MKDIR) $(DESTDIR)$(DATADIR)
# Install espeak executable
- $(INSTALL) -m 755 $(BIN2_NAME) $(DESTDIR)$(BINDIR)
+ $(INSTALL) -s -m 755 $(BIN2_NAME) $(DESTDIR)$(BINDIR)
# Install shared library
- $(INSTALL) -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)
- # Install static library
- $(INSTALL) -m 755 $(STATIC_LIB_NAME) $(DESTDIR)$(LIBDIR)
+ $(INSTALL) -s -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)
$(LN_SF) $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)/$(LIB_NAME).$(LIB_VERSION)
$(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
# Install development headers

View file

@ -15,5 +15,5 @@ espeak: but some find the articulation clearer and easier to listen to for
espeak: long periods. It can run as a command line program to speak text from
espeak: a file or from stdin.
espeak:
espeak:
espeak: Supported audio ouput drivers: @DRIVERS@
espeak: