# programs | # programs | ||||
platforms/*/espeak-phoneme-data | platforms/*/espeak-phoneme-data | ||||
espeak-ng | |||||
espeakedit | |||||
speak-ng | |||||
src/espeak-ng | |||||
src/espeakedit | |||||
src/speak-ng | |||||
# Linux/Source distribution files | # Linux/Source distribution files | ||||
#include <locale.h> | #include <locale.h> | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "espeak_ng.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "options.h" | #include "options.h" | ||||
extern void init_z(); | extern void init_z(); | ||||
extern void CompilePhonemeData(void); | extern void CompilePhonemeData(void); | ||||
extern void CompileSampleRate(void); | extern void CompileSampleRate(void); | ||||
extern "C" void CompileMbrola(const char *mbrola_file); | |||||
extern void CompileIntonation(); | extern void CompileIntonation(); | ||||
extern void InitSpectrumDisplay(); | extern void InitSpectrumDisplay(); | ||||
extern void InitProsodyDisplay(); | extern void InitProsodyDisplay(); | ||||
fprintf(stderr, "Failed to load default voice\n"); | fprintf(stderr, "Failed to load default voice\n"); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
CompileMbrola(argv[2]); | |||||
espeak_ng_CompileMbrolaVoice(argv[2], stdout); | |||||
} | } | ||||
exit(0); | exit(0); | ||||
} | } | ||||
case MENU_COMPILE_MBROLA: | case MENU_COMPILE_MBROLA: | ||||
{ | { | ||||
wxString filepath = wxFileSelector(_T("Read Mbrola phonemes file"),path_phsource+_T("/mbrola"),_T(""),_T(""),_T("*"),wxOPEN); | wxString filepath = wxFileSelector(_T("Read Mbrola phonemes file"),path_phsource+_T("/mbrola"),_T(""),_T(""),_T("*"),wxOPEN); | ||||
CompileMbrola(filepath.mb_str(wxConvLocal)); | |||||
espeak_ng_CompileMbrolaVoice(filepath.mb_str(wxConvLocal), stdout); | |||||
} | } | ||||
break; | break; | ||||
/* eSpeak NG API. | |||||
* | |||||
* Copyright (C) 2015 Reece H. Dunn | |||||
* | |||||
* This file is part of espeak-ng. | |||||
* | |||||
* This program is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation, either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_H | |||||
#define ESPEAK_NG_H | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
#ifdef __WIN32__ | |||||
#define ESPEAK_NG_API __declspec(dllexport) | |||||
#else | |||||
#define ESPEAK_NG_API | |||||
#endif | |||||
typedef enum { | |||||
/* Success Codes (>= 0) */ | |||||
ENS_OK = 0, | |||||
/* Error Codes (< 0) */ | |||||
ENE_NOT_FOUND = -1, | |||||
ENE_WRITE_FAILED = -2, | |||||
} espeak_ng_STATUS; | |||||
ESPEAK_NG_API espeak_ng_STATUS | |||||
espeak_ng_CompileMbrolaVoice(const char *path, FILE *log); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif |
#include <unistd.h> | #include <unistd.h> | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "espeak_ng.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
return(word); | return(word); | ||||
} | } | ||||
void CompileMbrola(const char *filepath) | |||||
espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log) | |||||
{ | { | ||||
char *p; | char *p; | ||||
FILE *f_in; | FILE *f_in; | ||||
strcpy(buf,filepath); | strcpy(buf,filepath); | ||||
if((f_in = fopen(buf,"r")) == NULL) | if((f_in = fopen(buf,"r")) == NULL) | ||||
{ | { | ||||
fprintf(stderr, "Can't read: %s\n", filepath); | |||||
return; | |||||
fprintf(log, "Can't read: %s\n", filepath); | |||||
return ENE_NOT_FOUND; | |||||
} | } | ||||
while(fgets(buf,sizeof(phoneme),f_in) != NULL) | while(fgets(buf,sizeof(phoneme),f_in) != NULL) | ||||
sprintf(buf,"%s/mbrola_ph/%s_phtrans",path_home,mbrola_voice); | sprintf(buf,"%s/mbrola_ph/%s_phtrans",path_home,mbrola_voice); | ||||
if((f_out = fopen(buf,"wb")) == NULL) | if((f_out = fopen(buf,"wb")) == NULL) | ||||
{ | { | ||||
fprintf(stderr, "Can't write to: %s\n", buf); | |||||
return; | |||||
fprintf(log, "Can't write to: %s\n", buf); | |||||
return ENE_WRITE_FAILED; | |||||
} | } | ||||
data[count].name = 0; // list terminator | data[count].name = 0; // list terminator | ||||
Write4Bytes(f_out, *pw); | Write4Bytes(f_out, *pw); | ||||
} | } | ||||
fclose(f_out); | fclose(f_out); | ||||
fprintf(stdout, "Mbrola translation file: %d phonemes", count); | |||||
fprintf(log, "Mbrola translation file: %s -- %d phonemes\n", buf, count); | |||||
return ENS_OK; | |||||
} | } |