How to Configure Espeak on Ubuntu 20.4.1

To configure espeak on Ubuntu 20.4.1

Introduction:

ESpeak is an open-source speech synthesizer for Windows, Mac, and Linux-based OS that provides the choice for listening to the text in multilingual which is clear and the available text in English and also be listened to in any other languages clearly. In this tutorial, we see about the configuration of espeak on Ubuntu 20.4.1.

Check the version of the OS:

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

Install git by using the following command:

root@linuxhelp:~# apt install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-42 linux-headers-5.4.0-42-generic linux-headers-5.4.0-52 linux-headers-5.4.0-52-generic
  linux-image-5.4.0-42-generic linux-image-5.4.0-52-generic linux-modules-5.4.0-42-generic
  linux-modules-5.4.0-52-generic linux-modules-extra-5.4.0-42-generic linux-modules-extra-5.4.0-52-generic
.
.
.

Download the package by using the following command:

root@linuxhelp:~# git clone https://github.com/espeak-ng/espeak-ng.git
Cloning into 'espeak-ng'...
remote: Enumerating objects: 102, done.
remote: Counting objects: 100% (102/102), done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 42431 (delta 42), reused 72 (delta 29), pack-reused 42329
Receiving objects: 100% (42431/42431), 49.57 MiB | 557.00 KiB/s, done.
Resolving deltas: 100% (29260/29260), done.

List the directory:

root@linuxhelp:~# ls -la
total 32
drwx------  5 root root 4096 Jan 11 10:18 .
drwxr-xr-x 20 root root 4096 Nov  6 04:51 ..
-rw-------  1 root root  376 Jan  9 12:44 .bash_history
-rw-r--r--  1 root root 3106 Dec  5  2019 .bashrc
drwx------  2 root root 4096 Jul 31 22:01 .cache
drwxr-xr-x 18 root root 4096 Jan 11 10:19 espeak-ng
-rw-r--r--  1 root root  161 Dec  5  2019 .profile
drwxr-xr-x  3 root root 4096 Jan 11 10:05 snap

Change the directory:

root@linuxhelp:~# cd espeak-ng/

Run the following command to execute the autoconfig package:

root@linuxhelp:~/espeak-ng# apt-get install autoconf automake pkg-config libgtk-3-dev dh-autoreconf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
pkg-config is already the newest version (0.29.1-0ubuntu4).
pkg-config set to manually installed.
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-42 linux-headers-5.4.0-42-generic linux-headers-5.4.0-52 linux-headers-5.4.0-52-generic
  linux-image-5.4.0-42-generic linux-image-5.4.0-52-generic linux-modules-5.4.0-42-generic
  linux-modules-5.4.0-52-generic linux-modules-extra-5.4.0-42-generic linux-modules-extra-5.4.0-52-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  autopoint autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential debhelper
  dh-strip-nondeterminism dpkg-dev dwz fakeroot g++ g++-9 gcc gcc-9 gettext gir1.2-harfbuzz-0.0 icu-devtools
.
.
.

Run the following command to execute the autogen script:

root@linuxhelp:~/espeak-ng# ./autogen.sh
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'

.
.
.

Once completed configure the package by using the below command:

root@linuxhelp:~/espeak-ng# ./configure --prefix=/usr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU data-style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
.
.
.

Run the following commands to install make packages:

root@linuxhelp:~/espeak-ng# apt install make
Reading package lists... Done
Building dependency tree       
Reading state information... Done
make is already the newest version (4.2.1-1.2).
make set to manually installed.
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-42 linux-headers-5.4.0-42-generic linux-headers-5.4.0-52 linux-headers-5.4.0-52-generic
  linux-image-5.4.0-42-generic linux-image-5.4.0-52-generic linux-modules-5.4.0-42-generic
  linux-modules-5.4.0-52-generic linux-modules-extra-5.4.0-42-generic linux-modules-extra-5.4.0-52-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 209 not upgraded.

Execute the make files by using the below command:

root@linuxhelp:~/espeak-ng# make
make  all-am
make[1]: Entering directory '/root/espeak-ng'
  CC       src/speak-ng.o
In file included from src/speak-ng.c:23:
src/espeak-ng.c: In function ‘main’:
src/espeak-ng.c:744:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  744 |   fread(p_text, 1, filesize, f_text);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
.
.

Install make packages in espeak:

root@linuxhelp:~/espeak-ng# make install
make[1]: Entering directory '/root/espeak-ng'
 /usr/bin/mkdir -p '/usr/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   src/libespeak-ng.la '/usr/lib'
libtool: install: /usr/bin/install -c src/.libs/libespeak-ng.so.1.1.51 /usr/lib/libespeak-ng.so.1.1.51
libtool: install: (cd /usr/lib && { ln -s -f libespeak-ng.so.1.1.51 libespeak-ng.so.1 || { rm -f libespeak-ng.so.1 && ln -s libespeak-ng.so.1.1.51 libespeak-ng.so.1; }; })
libtool: install: (cd /usr/lib && { ln -s -f libespeak-ng.so.1.1.51 libespeak-ng.so || { rm -f libespeak-ng.so && ln -s libespeak-ng.so.1.1.51 libespeak-ng.so; }; })
libtool: install: /usr/bin/install -c src/.libs/libespeak-ng.lai /usr/lib/libespeak-ng.la
libtool: install: /usr/bin/install -c src/.libs/libespeak-ng.a /usr/lib/libespeak-ng.a
libtool: install: chmod 644 /usr/lib/libespeak-ng.a
libtool: install: ranlib /usr/lib/libespeak-ng.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sbin" ldconfig -n /usr/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
.
.
.

Run the following command to get the output in espeak:

root@linuxhelp:~/espeak-ng# espeak-ng -v en-us --stdout   "hai hello how are you" -s 100  > /home/Downloads/english.mp3

Run the following command to install mbrola us English language:

root@linuxhelp:~/espeak-ng# apt install mbrola-us1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-42 linux-headers-5.4.0-42-generic linux-headers-5.4.0-52 linux-headers-5.4.0-52-generic
  linux-image-5.4.0-42-generic linux-image-5.4.0-52-generic linux-modules-5.4.0-42-generic
  linux-modules-5.4.0-52-generic linux-modules-extra-5.4.0-42-generic linux-modules-extra-5.4.0-52-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mbrola
Suggested packages:
  espeak cicero
The following NEW packages will be installed:
  mbrola mbrola-us1
0 upgraded, 2 newly installed, 0 to remove and 209 not upgraded.
Need to get 6,214 kB of archives.
.
.
.

Run the following command to get the output in mbrola espeak:

root@linuxhelp:~/espeak-ng# espeak-ng --stdout -a 10 -p 50 -v mb-us1  "hai hello how are you" -s 30  > /home/Downloads/english1.mp3

With this, the configuration of espeak on Ubuntu 20.4.1 comes to an end.

Tag : Espeak Ubuntu
FAQ
Q
What is the command to get output in voice?
A
espeak-ng -v en-us --stdout "hai hello how are you" -s 100 > /home/Downloads/english.mp3
Q
How to Install Mbrola on Ubuntu 20.4.1?
A
By using below command we can Install Mbrola
# apt install mbrola-us1
Q
How to use Espeak on windows?
A
Download the latest version of eSpeak for Windows from Sourceforge. The installation files will be in your downloads directory in a zip archive. Double click the zip archive to open it, and transfer the contents to the desktop.
Q
How do change the voice On Espeak?
A
Use -v option in command, after that give the language name in that command.
Q
What is Espeak?
A
eSpeak Speech Synthesizer is an open source speech synthesizer for Windows, Mac and Linux based OS. It provides the option for listening to text in multiple languages. The speech is clear and the available text in English, can be listened to in any alternative language easily.