ai) gni n^ // craignions châtaignier | ai) gni n^ // craignions châtaignier | ||||
gn nj // agneau | gn nj // agneau | ||||
_wa) gner (_ gnEr | _wa) gner (_ gnEr | ||||
_sta) gn ( gn | |||||
dia) gn ( gn | |||||
_sta) gn gn | |||||
dia) gn gn | |||||
_) gn (om gn | _) gn (om gn | ||||
_) gn (ou_ gn | _) gn (ou_ gn | ||||
gn (osie_ gn | gn (osie_ gn |
break; | break; | ||||
case 0x10e: // --compile-mbrola | case 0x10e: // --compile-mbrola | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0); | ||||
espeak_ng_CompileMbrolaVoice(optarg2, stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompileMbrolaVoice(optarg2, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
case 0x10f: // --compile-intonations | case 0x10f: // --compile-intonations | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | ||||
espeak_ng_CompileIntonation(stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompileIntonation(stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
case 0x110: // --compile-phonemes | case 0x110: // --compile-phonemes | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | ||||
espeak_ng_CompilePhonemeData(22050, stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompilePhonemeData(22050, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
default: | default: | ||||
exit(0); | exit(0); | ||||
} | } | ||||
if (flag_compile) { | if (flag_compile) { | ||||
// This must be done after the voice is set | // This must be done after the voice is set | ||||
espeak_CompileDictionary("", stderr, flag_compile & 0x1); | |||||
exit(0); | |||||
return (espeak_ng_CompileDictionary("", NULL, stderr, flag_compile & 0x1) == ENS_OK) | |||||
? EXIT_SUCCESS : EXIT_FAILURE; | |||||
} | } | ||||
// set any non-default values of parameters. This must be done after espeak_Initialize() | // set any non-default values of parameters. This must be done after espeak_Initialize() |
#define espeakINITIALIZE_PATH_ONLY 0x4000 | #define espeakINITIALIZE_PATH_ONLY 0x4000 | ||||
ESPEAK_NG_API espeak_ng_STATUS | ESPEAK_NG_API espeak_ng_STATUS | ||||
espeak_ng_CompileMbrolaVoice(const char *path, FILE *log); | |||||
espeak_ng_CompileDictionary(const char *dsource, | |||||
const char *dict_name, | |||||
FILE *log, | |||||
int flags); | |||||
ESPEAK_NG_API espeak_ng_STATUS | ESPEAK_NG_API espeak_ng_STATUS | ||||
espeak_ng_CompilePhonemeData(long rate, FILE *log); | |||||
espeak_ng_CompileMbrolaVoice(const char *path, | |||||
FILE *log); | |||||
ESPEAK_NG_API espeak_ng_STATUS | |||||
espeak_ng_CompilePhonemeData(long rate, | |||||
FILE *log); | |||||
ESPEAK_NG_API espeak_ng_STATUS | ESPEAK_NG_API espeak_ng_STATUS | ||||
espeak_ng_CompileIntonation(FILE *log); | espeak_ng_CompileIntonation(FILE *log); |
fclose(f_errors); | fclose(f_errors); | ||||
ReadPhondataManifest(); | ReadPhondataManifest(); | ||||
return ENS_OK; | |||||
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK; | |||||
} | } | ||||
static const char *preset_tune_names[] = { | static const char *preset_tune_names[] = { |
#include <stdint.h> | #include <stdint.h> | ||||
#endif | #endif | ||||
#include "espeak_ng.h" | |||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
return 0; | return 0; | ||||
} | } | ||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname_err, int flags) | |||||
#pragma GCC visibility push(default) | |||||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileDictionary(const char *dsource, const char *dict_name, FILE *log, int flags) | |||||
{ | { | ||||
if (!log) log = stderr; | |||||
if (!dict_name) dict_name = dictionary_name; | |||||
// fname: space to write the filename in case of error | // fname: space to write the filename in case of error | ||||
// flags: bit 0: include source line number information, for debug purposes. | // flags: bit 0: include source line number information, for debug purposes. | ||||
sprintf(fname_in, "%srules.txt", path); | sprintf(fname_in, "%srules.txt", path); | ||||
if ((f_in = fopen(fname_in, "r")) == NULL) { | if ((f_in = fopen(fname_in, "r")) == NULL) { | ||||
sprintf(fname_in, "%srules", path); | sprintf(fname_in, "%srules", path); | ||||
if ((f_in = fopen_log(fname_in, "r")) == NULL) { | |||||
if (fname_err) | |||||
strcpy(fname_err, fname_in); | |||||
return -1; | |||||
} | |||||
if ((f_in = fopen_log(fname_in, "r")) == NULL) | |||||
return ENE_READ_ERROR; | |||||
} | } | ||||
sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name); | sprintf(fname_out, "%s%c%s_dict", path_home, PATHSEP, dict_name); | ||||
if ((f_out = fopen_log(fname_out, "wb+")) == NULL) { | if ((f_out = fopen_log(fname_out, "wb+")) == NULL) { | ||||
if (fname_err) | |||||
strcpy(fname_err, fname_out); | |||||
fclose(f_in); | fclose(f_in); | ||||
return -1; | |||||
return ENE_WRITE_ERROR; | |||||
} | } | ||||
sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP); | sprintf(fname_temp, "%s%ctemp", path_home, PATHSEP); | ||||
LoadDictionary(translator, dict_name, 0); | LoadDictionary(translator, dict_name, 0); | ||||
return error_count; | |||||
return error_count > 0 ? ENE_COMPILE_ERRORS : ENS_OK; | |||||
} | } | ||||
#pragma GCC visibility pop |
#pragma GCC visibility push(default) | #pragma GCC visibility push(default) | ||||
espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log) | espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log) | ||||
{ | { | ||||
if (!log) log = stderr; | |||||
char *p; | char *p; | ||||
FILE *f_in; | FILE *f_in; | ||||
FILE *f_out; | FILE *f_out; |
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags) | ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags) | ||||
{ | { | ||||
CompileDictionary(path, dictionary_name, log, NULL, flags); | |||||
espeak_ng_CompileDictionary(path, dictionary_name, log, flags); | |||||
} | } | ||||
ESPEAK_API espeak_ERROR espeak_Cancel(void) | ESPEAK_API espeak_ERROR espeak_Cancel(void) |
void Write4Bytes(FILE *f, int value); | void Write4Bytes(FILE *f, int value); | ||||
int Read4Bytes(FILE *f); | int Read4Bytes(FILE *f); | ||||
int Reverse4Bytes(int word); | int Reverse4Bytes(int word); | ||||
int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *err_name, int flags); | |||||
#define ENV_LEN 128 // length of pitch envelopes | #define ENV_LEN 128 // length of pitch envelopes | ||||
#define PITCHfall 0 // standard pitch envelopes | #define PITCHfall 0 // standard pitch envelopes |
break; | break; | ||||
case 0x10e: // --compile-mbrola | case 0x10e: // --compile-mbrola | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0); | ||||
espeak_ng_CompileMbrolaVoice(optarg2, stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompileMbrolaVoice(optarg2, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
case 0x10f: // --compile-intonations | case 0x10f: // --compile-intonations | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | ||||
espeak_ng_CompileIntonation(stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompileIntonation(stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
case 0x110: // --compile-phonemes | case 0x110: // --compile-phonemes | ||||
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, espeakINITIALIZE_PATH_ONLY); | ||||
espeak_ng_CompilePhonemeData(22050, stdout); | |||||
exit(0); | |||||
return (espeak_ng_CompilePhonemeData(22050, stdout) == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
default: | default: | ||||
exit(0); | exit(0); | ||||
} | } | ||||
strcpy(path_dsource, path_home); | strcpy(path_dsource, path_home); | ||||
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end | path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end | ||||
strcat(path_dsource, "dictsource\\"); | strcat(path_dsource, "dictsource\\"); | ||||
CompileDictionary(path_dsource, dictionary_name, NULL, NULL, flag_compile & 0x1); | |||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(path_dsource, dictionary_name, NULL, flag_compile & 0x1); | |||||
#else | #else | ||||
#ifdef PLATFORM_WINDOWS | #ifdef PLATFORM_WINDOWS | ||||
char path_dsource[sizeof(path_home)+20]; | char path_dsource[sizeof(path_home)+20]; | ||||
strcpy(path_dsource, path_home); | strcpy(path_dsource, path_home); | ||||
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end | path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end | ||||
strcat(path_dsource, "dictsource\\"); | strcat(path_dsource, "dictsource\\"); | ||||
CompileDictionary(path_dsource, dictionary_name, NULL, NULL, flag_compile & 0x1); | |||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(path_dsource, dictionary_name, NULL, flag_compile & 0x1); | |||||
#else | #else | ||||
CompileDictionary(NULL, dictionary_name, NULL, NULL, flag_compile & 0x1); | |||||
espeak_ng_STATUS status = espeak_ng_CompileDictionary(NULL, dictionary_name, NULL, flag_compile & 0x1); | |||||
#endif | #endif | ||||
#endif | #endif | ||||
exit(0); | |||||
return (status == ENS_OK) ? EXIT_SUCCESS : EXIT_FAILURE; | |||||
} | } | ||||
SetParameter(espeakRATE, speed, 0); | SetParameter(espeakRATE, speed, 0); |