-
Notifications
You must be signed in to change notification settings - Fork 2
License
hgneng/ekho-android-cantonese
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
##### How to build Mandarin Voice ##### 1. jni/jni/EkhoService.cpp about line 223, change to gp_ekho->setVoice("Mandarin"); 2. res/raw/ekhodata.zip->Cantonese files(.dict/.voice/.index) replace with linux ekho-9.0.tar.xz->Mandarin files(.dict/.voice/.index) 3. change applicationId in build.gradle 4. change app_name in res/values/donottranslate.xml 5. change icon 6. change CheckVoiceData.java $ git diff src/net/eguidedog/ekho/CheckVoiceData.java diff --git a/src/net/eguidedog/ekho/CheckVoiceData.java b/src/net/eguidedog/ekho/CheckVoiceData.java index 1d62312..8789756 100644 --- a/src/net/eguidedog/ekho/CheckVoiceData.java +++ b/src/net/eguidedog/ekho/CheckVoiceData.java @@ -47,9 +47,12 @@ public class CheckVoiceData extends Activity { /** Resources required for Ekho to run correctly. */ private static final String[] BASE_RESOURCES = { - "zhy.dict", - "jyutping.index", - "jyutping.voice", + "zh.dict", + "pinyin.index", + "pinyin.voice", + //"zhy.dict", + //"jyutping.index", + //"jyutping.voice", }; public static File getDataPath(Context context) { ##### How to build ##### 1. open project with Android Studio. 2. ndk-build V=1 ##### Build eSpeak NG Android project ##### 1. get code and build from https://github.com/espeak-ng/espeak-ng/tree/master/android 2. fix checksum plugin issue: https://plugins.gradle.org/plugin/org.gradle.crypto.checksum 3. copy espeak-ng-data from a relase version ##### support English ##### see jni/flite_diff Flite latest source: https://github.com/festvox/flite Flite home page: http://www.festvox.org/flite/ build systems: https://developer.android.com/ndk/guides/other_build_systems git clone https://github.com/festvox/flite cd flite ./configure --with-langvox=android --target=arm64-androidmake link arm64-v8a-android -> aarch64-android in flite/build change config/config make ./configure --with-langvox=android --target=arm-android link armeabi-v7a-android -> arm-android in flite/build change config/config make ./configure --with-langvox=android --target=x86-android change config/config make ./configure --with-langvox=android --target=x86_64-android change config/config make change compiler in flite/config/config for x86-android: CC = /Users/hgneng/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ CFLAGS = -g -O2 -Wall -fpic -O3 -DANDROID --sysroot=/Users/hgneng/Library/Android/sdk/ndk/21.4.7075529/sysroot -I/Users/hgneng/Library/Android/sdk/ndk/21.4.7075529/sysroot/usr/include/i686-linux-android AR = /Users/hgneng/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar RANLIB = /Users/hgneng/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ranlib ##### Troubleshooting ##### We may need to fix atof with strtod. We may need to upgrade Android API to 21 (minSdkVersion in build.gradle and APP_PLATFORM := android-21 in Application.mk) to fix undefined reference 'rand' issue. (refer to https://stackoverflow.com/questions/66455212/android-ndk-returns-an-error-undefined-reference-to-rand-srand) We may need to use nm to check flite.a to debug undefined reference issue. Sometimes, we use C++ compiler to build flite will cause undefined reference issue. Symbols may be stripped in some so file in order to reduce size. g721_encoder g721_decoder exists both in flite and libsndfile. Need to rename them in flite in case of conflict. After modifying libs, we need to make some changes in EkhoService.cpp to trigger re-link the libs and generate a new libttsekho.so. ##### flite diff ##### ~/code/ekho-android-cantonese/jni/flite$ git diff diff --git a/config/android.lv b/config/android.lv index ff5422e..19dc4db 100644 --- a/config/android.lv +++ b/config/android.lv @@ -1,5 +1,8 @@ # # The base languages, lexicons and voices -LEXES += cmulex cmu_indic_lang -LANGS += usenglish cmu_indic_lex +#LEXES += cmulex cmu_indic_lang +LEXES += cmulex +#LANGS += usenglish cmu_indic_lex +LANGS += usenglish #VOXES += cmu_us_generic_cg +VOXES += cmu_us_kal diff --git a/src/utils/cst_string.c b/src/utils/cst_string.c index 38bc5f3..1242b36 100644 --- a/src/utils/cst_string.c +++ b/src/utils/cst_string.c @@ -74,7 +74,8 @@ cst_string *cst_strrchr(const cst_string *str, int c) double cst_atof(const char *str) { - return atof(str); + char* endPtr; + return strtod(str, &endPtr); } #endif /* WinCE */ ekho-android-cantonese/jni/flite$ git diff diff --git a/src/speech/cst_wave_utils.c b/src/speech/cst_wave_utils.c index c69066e..ef11c5f 100644 --- a/src/speech/cst_wave_utils.c +++ b/src/speech/cst_wave_utils.c @@ -163,7 +163,7 @@ unsigned char *cst_g721_decode(int *actual_size,int size, code = (xcode & 0xF0) >> dec_bits; else code = (xcode & 0x0F); - sample_short = g721_decoder(code,AUDIO_ENCODING_LINEAR,&state); + sample_short = flite_g721_decoder(code,AUDIO_ENCODING_LINEAR,&state); unpacked_residual[ur] = cst_short_to_ulaw(sample_short); } diff --git a/src/speech/g721.c b/src/speech/g721.c index d1cec7b..e51efd4 100644 --- a/src/speech/g721.c +++ b/src/speech/g721.c @@ -115,7 +115,7 @@ static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, * the resulting code. -1 is returned for unknown input coding value. */ int -g721_encoder( +flite_g721_encoder( int sl, int in_coding, struct g72x_state *state_ptr) @@ -166,7 +166,7 @@ g721_encoder( * return -1 for unknown out_coding value. */ int -g721_decoder( +flite_g721_decoder( int i, int out_coding, struct g72x_state *state_ptr) diff --git a/src/speech/g72x.h b/src/speech/g72x.h index ab18d8e..17759b4 100644 --- a/src/speech/g72x.h +++ b/src/speech/g72x.h @@ -118,11 +118,11 @@ struct g72x_state { /* External function definitions. */ extern void g72x_init_state(struct g72x_state *); -extern int g721_encoder( +extern int flite_g721_encoder( int sample, int in_coding, struct g72x_state *state_ptr); -extern int g721_decoder( +extern int flite_g721_decoder( int code, int out_coding, struct g72x_state *state_ptr);
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published