From bda5252b3f4c6f510ee6bf8c2c05820605685c17 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 13 Dec 2015 17:45:11 +0000 Subject: [PATCH] espeak-ng: implement and use --compile-intonations and --compile-phonemes command-line options --- Makefile.am | 4 +++- src/espeak-ng.c | 16 ++++++++++++++++ src/include/espeak-ng/espeak_ng.h | 2 ++ src/libespeak-ng/speak_lib.c | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 8c664c67..e7316303 100644 --- a/Makefile.am +++ b/Makefile.am @@ -279,7 +279,9 @@ phsource/phonemes.stamp: \ phsource/ph_zh_yue \ phsource/phonemes \ src/espeakedit - ESPEAK_DATA_PATH=$(PWD) src/espeakedit --compile && touch $@ + ESPEAK_DATA_PATH=$(PWD) src/espeak-ng --compile-intonations && \ + ESPEAK_DATA_PATH=$(PWD) src/espeak-ng --compile-phonemes && \ + touch $@ ##### dictionaries: diff --git a/src/espeak-ng.c b/src/espeak-ng.c index 345fee84..a30a01db 100644 --- a/src/espeak-ng.c +++ b/src/espeak-ng.c @@ -76,6 +76,10 @@ static const char *help_text = "\t directory. specifies the language\n" "--compile-mbrola=\n" "\t Compile an MBROLA voice\n" +"--compile-intonations\n" +"\t Compile the intonation data\n" +"--compile-phonemes\n" +"\t Compile the phoneme data\n" "--ipa Write phonemes to stdout using International Phonetic Alphabet\n" "--path=\"\"\n" "\t Specifies the directory containing the espeak-data directory\n" @@ -429,6 +433,8 @@ int main (int argc, char **argv) {"sep", optional_argument, 0, 0x10c}, {"tie", optional_argument, 0, 0x10d}, {"compile-mbrola", optional_argument, 0, 0x10e}, + {"compile-intonations", no_argument, 0, 0x10f}, + {"compile-phonemes", no_argument, 0, 0x110}, {0, 0, 0, 0} }; @@ -719,6 +725,16 @@ int main (int argc, char **argv) espeak_ng_CompileMbrolaVoice(optarg2, stdout); exit(0); + case 0x10f: // --compile-intonations + samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,0,data_path,espeakINITIALIZE_PATH_ONLY); + espeak_ng_CompileIntonation(stdout); + exit(0); + + case 0x110: // --compile-phonemes + samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,0,data_path,espeakINITIALIZE_PATH_ONLY); + espeak_ng_CompilePhonemeData(22050, stdout); + exit(0); + default: exit(0); } diff --git a/src/include/espeak-ng/espeak_ng.h b/src/include/espeak-ng/espeak_ng.h index dd74f5ec..8300fef1 100644 --- a/src/include/espeak-ng/espeak_ng.h +++ b/src/include/espeak-ng/espeak_ng.h @@ -45,6 +45,8 @@ typedef enum { ENE_COMPILE_ERRORS = -4, } espeak_ng_STATUS; +#define espeakINITIALIZE_PATH_ONLY 0x4000 + ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *path, FILE *log); diff --git a/src/libespeak-ng/speak_lib.c b/src/libespeak-ng/speak_lib.c index 75331e05..921f072c 100644 --- a/src/libespeak-ng/speak_lib.c +++ b/src/libespeak-ng/speak_lib.c @@ -40,6 +40,7 @@ #endif #include "speak_lib.h" +#include "espeak_ng.h" #include "phoneme.h" #include "synthesize.h" #include "voice.h" @@ -786,6 +787,9 @@ ENTER("espeak_Initialize"); #endif init_path(path); + if(options & espeakINITIALIZE_PATH_ONLY) + return 0; + initialise(options); select_output(output_type);