126.3. espeak-ng-1.52.0
Speech synthesis for over 100 languages, in about 15 MB
| Version | 1.52.0, release 1 |
| Shelf | accessibility — Screen readers, speech, braille and alternative input |
| Phase | 41_system (System), 15 of 1047 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://github.com/espeak-ng/espeak-ng |
| Build time | 0.6 SBU |
| Installed size | 23.7 MiB in 481 files |
| Recipe | ports/core/accessibility/espeak-ng/kpkgbuild |
About
eSpeak NG is the speech synthesiser of KDOS: Speech Dispatcher’s one voice, and so Orca’s, KMouth’s and every Qt TextToSpeech program’s, and the voice BRLTTY links into its daemon for speech at the text console. It covers over a hundred languages in about 15 MB. The package installs the espeak-ng command, libespeak-ng with its eSpeak compatibility header, and the voice data. How speech reaches the sound card is in Speech and the sound card.
Why it is in KDOS
The comment above pcaudiolib and espeak-ng in script/phases/41_system/packages.d/accessibility.txt:
A synthesiser, not a screen reader — what it buys alone is the corpus read aloud on a machine whose 49 GB of documentation needs eyes.
Sources
espeak-ng-1.52.0.tar.gz(16.9 MiB)
sha256bb4338102ff3b49a81423da8a1a158b420124b055b60fa76cfb4b18677130a23
upstream: https://github.com/espeak-ng/espeak-ng/archive/refs/tags/1.52.0.tar.gz
archive copy: sources-1/accessibility--espeak-ng-1.52.0.tar.gz
Dependencies
Depends on: autoconf, automake, libtool, pkgconf, pcaudiolib.
Required by (3): brltty, kmouth, speech-dispatcher.
Patches
build.sh applies these; kpkg applies nothing by itself.
close-audio-when-idle.patch— Close the sound device after each utterance instead of at terminationA program speaking straight to the device (espeak_Initialize with AUDIO_OUTPUT_PLAYBACK) held the PCM open from its first word until espeak_ng_Terminate. Open it on the first samples of an utterance, close it once they drain or are cancelled, and reopen at the same rate on the next.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install espeak-ng'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/accessibility/espeak-ng.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/accessibility/espeak-ng
echo 'bb4338102ff3b49a81423da8a1a158b420124b055b60fa76cfb4b18677130a23 espeak-ng-1.52.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/espeak-ng
SRC=$SRC_ROOT/espeak-ng-1.52.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf espeak-ng-1.52.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/close-audio-when-idle.patch"
./autogen.sh
./configure \
--prefix=/usr \
--libdir=/usr/lib \
--disable-static \
--with-mbrola=no \
--with-sonic=no \
--with-pcaudiolib=yes \
RONN=no KRAMDOWN=no \
ac_cv_header_valgrind_memcheck_h=no
make 'src_speak_ng_LDFLAGS=-lm $(PCAUDIOLIB_LIBS)'
make DESTDIR=$PKG 'src_speak_ng_LDFLAGS=-lm $(PCAUDIOLIB_LIBS)' install
The switches, and why each is set:
--with-pcaudiolib=yes— play audio through pcaudiolib, the library behindespeak-ng "text"and every program that asks the library to play rather than hand back samples, BRLTTY among them. Speech Dispatcher takes the samples and plays them itself.--with-mbrola=no— with--with-sonic=no: no MBROLA diphone voices, which are not a port, and no Sonic speed-up library, which is not one either.ac_cv_header_valgrind_memcheck_h=no— never compile in the Valgrind client requests, whether or not a Valgrind header happens to be installed.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/espeak-ng, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf espeak-ng-1.52.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/espeak-ng, and runs the triggers its paths call for.
Contents
Installed programs: espeak, espeak-ng, speak, speak-ng.
Installed libraries: libespeak-ng.so.
Installed directories: /usr/include/espeak, /usr/include/espeak-ng, /usr/share/espeak-ng-data, /usr/share/licenses/espeak-ng, /usr/share/vim/addons, /usr/share/vim/registry.
Short descriptions
espeak-ng.pc |
eSpeak NG is a multi-lingual software speech synthesizer |
Notes
close-audio-when-idle.patch makes a program that speaks through the library hold the sound device only while an utterance plays: it closes the device once an utterance drains or is cancelled and reopens it at the same rate for the next, at the cost of a device open per utterance. Without it the library opens the device on the first word and closes it only when the program ends, so a BRLTTY with a speech driver would hold the sound card from its first word until it stops, and PipeWire could not resume on it meanwhile.
Both make lines set src_speak_ng_LDFLAGS to -lm $(PCAUDIOLIB_LIBS), upstream’s value less its -static and the fuzzer library, which is empty outside a fuzzing build, so the speak-ng program links the shared libespeak-ng, the only build of the library that --disable-static leaves. RONN=no and KRAMDOWN=no tell configure that neither Markdown converter is present, whatever the build root holds, so no manual pages or HTML are generated from the Markdown sources.