This makes the following changes:
1. setVoice takes a Voice object instead of a language string.
This is to make the API cleaner and allows SpeechSynthesis
to pass the correct parameter (identifier for SetVoiceByName,
or name for SetVoiceByProperties) to espeak.
2. The espeak_SetVoiceByName API is also exposed to support passing
the voice variant to use.
3. The age parameter has been re-added with the constants:
* SpeechSynthesis.AGE_ANY
* SpeechSynthesis.AGE_YOUNG
* SpeechSynthesis.AGE_OLD
based on the behaviour of the eSpeak voice selection algorithm.
NOTE: Due to the way that voice selection is implemented in eSpeak,
if variant is specified, the age and gender cannot be specified and
vice versa.
Android Port of eSpeak Text-to-Speech
This branch contains the files needed to build espeak on the android platform. It is derived from the eyes-free project.
Prerequisits
To build eSpeak for Android, you need to have the following installed and configured correctly:
- Android SDK
- Android NDK
- wxWidgets 2.8 (for espeakedit when building
android/res/raw/espeakdata.zip)
If you are building with Eclipse, you will also need:
- Eclipse
- Android Developer Tools (ADT) for Eclipse
If you are building on the command line, you will also need:
- ant (e.g. run
sudo apt-get install anton a Debian-based distribution)
Fetching the Sources
The Android port uses the ucd-tools submodule. You can fetch this by running:
$ git submodule init
$ git submodule update
Building eSpeak
-
Build the
libttsespeak.sofile by running:$ cd android $ ndk-build -
Build the
android/res/raw/espeakdata.zipfile by running:$ ./autogen.sh $ ./configure --prefix=/usr $ make android
Building the APK with Eclipse
- Open Eclipse.
- Create a new workspace.
- Import the espeak folder as an exising Android project.
- Build the espeak apk within Eclipse.
The generated eSpeakActivity.apk can be installed like any other apk build
via eclipse, such as by using the Run menu option.
Building the APK from the Command Line
-
Update the project using the Android utility which is part of the SDK:
$ cd android $ android update project -s -t 1 -p . -
Build the package.
$ ant release
In order to install the built bin/eSpeakActivity-release-unsigned.apk APK,
you need to self-sign the package. You can do this by:
-
Creating a certificate, if you do not already have one:
$ keytool -genkey -keystore [YOUR_CERTIFICATE] -alias [ALIAS] -
Sign the package using your certificate:
$ jarsigner -sigalg MD5withRSA -digestalg SHA1 \ -keystore [YOUR_CERTIFICATE] \ bin/eSpeakActivity-release-unsigned.apk [ALIAS] -
Align the apk using the zipalign tool.
$ zipalign 4 bin/eSpeakActivity-release-unsigned.apk \ bin/eSpeakActivity-release-signed.apk
Now, you can install the APK using the adb tool:
$ adb install -r bin/eSpeakActivity-release-signed.apk
Enabling eSpeak on the Device
After running, eSpeakActivity will extract the espeakdata.zip file into its
own data directory to set up the available voices.
To enable eSpeak, you need to:
- go into the Android
Text-to-Speech settingsUI; - enable
eSpeak TTSin theEnginessection; - select
eSpeak TTSas the default engine; - use the
Listen to an exampleoption to check if everything is working.