How to Compile ESpeak Text-To-Speech Engine From Source on PcDuino3

Introduction: How to Compile ESpeak Text-To-Speech Engine From Source on PcDuino3

Original post from

Twitter :@pcDuino_NO1
Facebook: pcDuino
Google:  pcDuino


eSpeak is a text-to-speech engine that you can install on pcDuino3 to incorporate synthesized speech into your project.
In the 20140721 ( release date 21 July 2014 ) Ubuntu rootfs, eSpeak is available from the repository and you can install it on pcDuino3 with
$ sudo apt-get update && sudo apt-get install espeak

Step 1: Glitches

However, eSpeak installed from the repository has a couple of minor glitches – one is that, when speech rate is set to fast (above 200 words per minute), and the sentence to be spoken is long (more than 20 words), eSpeak will not speak the last few words.

Another thing is that, the installation only has limited vocabulary for Chinese language. This is because dictionary files could take up a lot of space and so is not bundled together with standard eSpeak installation.

To address those glitches, you can compile eSpeak from source on pcDuino3.

You will need the following:
1. Source code for eSpeak
2. Several additional packages that will be needed when building eSpeak.
3. The additional dictionary data file for Chinese (if you want Chinese Text-To-Speech)

Step 2: Step-By-Step Guide to Compile ESpeak:

1.Download the sourcecode for eSpeak v1.46.02 from SourceForge NOTE: newer versions of eSpeak are available, but this one works specifically with Ubuntu 12.04. Installing newer ones will give a “version mismatch” error

2.Unzip the source by executing:
$ unzip

This will extract the source into directory /home/ubuntu/espeak-1.46.02-source/ (NOTE: this tutorial asumes you are working in the /home/ubuntu/ directory). If you look inside that directory, you’ll see:
$ ls /home/ubuntu/espeak-1.46.02-source/
ChangeLog.txt  ReadMe      docs         linux_32bit  src
License.txt    dictsource  espeak-data  platforms

Take note of the dictsource directory, that’s where we will need to place the additional Chinese dictionary data when compiling eSpeak.
3.Download the additional dictionary data for Chinese language from epeak’s additional data page

4.Unzip the file ( zh_listx) and move the content to that /home/ubuntu/espeak-1.46.02-source/dictsource/ directory. NOTE: Not all languages has big dictionary data, most are small enough that you don’t need to do step 3 and 4. For other languages with big dictionary data where you need to manually add in the dictionary data, see:

5.Install several packages needed to compile eSpeak, by executing the following:
sudo apt-get update
sudo apt-get install make autoconf automake libtool pkg-config
sudo apt-get install  portaudio19-dev
sudo apt-get install  libasound2-dev
sudo apt-get install  libportaudio2
sudo apt-get install  libportaudiocpp0
sudo apt-get install libwxgtk2.8-dev
sudo apt-get install  libpulse-dev
sudo apt-get install  libportaudio-dev

6.Now we are ready to build eSpeak. Let’s navigate into the src folder and build it:
$ cd /home/ubuntu/espeak-1.46.02-source/src/
$ make
$ sudo make-install

7. Compile eSpeak with the additional Chinese dictionary file. Let’s navigate into the dictsource folder:
$ cd /home/ubuntu/espeak-1.46.02-source/dictsource/
and execute:
$ sudo espeak --compile=zh
NOTE: You can skip this step if you are not planning to use Chinese TTS. For other languages, replace –compile=zh with the equivalent.

8.Now, eSpeak is built and compiled. But before we can use it, we need to install one more package:
$ sudo apt-get install speech-dispatcher

9. You’re all set! :) to use eSpeak, simply do something like:
$ espeak "Hello there."
for English, or:
$ espeak -v zh -s 150  "你好."
for Chinese. The “-v zh” option sets the voice to Chinese and the “-s 150″ sets the speech-rate to 150 words per minute. To find out more options for using eSpeak:
$ espeak -h
NOTE: for Chinese text, please separate numbers from Chinese characters in a line of text, by putting spaces around the numbers. e.g. “2014 年 8 月 6″ instead of “2014年8月6日”. eSpeak will make an error if numbers are placed between Chinese characters without spacing.

Now you’re ready to make your project talk! :)



    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest