espeak-ng: implement a --compile-mbrola command-line option

This commit is contained in:
Reece H. Dunn
2015-12-12 13:27:37 +00:00
parent b8378c2667
commit 6bd44bd926
2 changed files with 18 additions and 1 deletions
+8
View File
@@ -30,6 +30,7 @@
#include <sys/stat.h>
#include "speak_lib.h"
#include "espeak_ng.h"
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
@@ -73,6 +74,8 @@ static const char *help_text =
"--compile=<voice name>\n"
"\t Compile pronunciation rules and dictionary from the current\n"
"\t directory. <voice name> specifies the language\n"
"--compile-mbrola=<voice name>\n"
"\t Compile an MBROLA voice\n"
"--ipa Write phonemes to stdout using International Phonetic Alphabet\n"
"--path=\"<path>\"\n"
"\t Specifies the directory containing the espeak-data directory\n"
@@ -425,6 +428,7 @@ int main (int argc, char **argv)
{"version", no_argument, 0, 0x10b},
{"sep", optional_argument, 0, 0x10c},
{"tie", optional_argument, 0, 0x10d},
{"compile-mbrola", optional_argument, 0, 0x10e},
{0, 0, 0, 0}
};
@@ -710,6 +714,10 @@ int main (int argc, char **argv)
phonemes_separator = 0x200d; // ZWJ
break;
case 0x10e: // --compile-mbrola
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,0,data_path,0);
espeak_ng_CompileMbrolaVoice(optarg2, stdout);
exit(0);
default:
exit(0);
+10 -1
View File
@@ -19,7 +19,6 @@
***************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include "speak_lib.h"
#include "espeak_ng.h"
@@ -28,6 +27,14 @@
#include "speech.h"
#include "synthesize.h"
static const char *basename(const char *filename)
{
const char *current = filename + strlen(filename);
while (current != filename && !(*current == '/' || *current == '\\'))
--current;
return current == filename ? current : current + 1;
}
static unsigned int StringToWord(const char *string)
{
// Pack 4 characters into a word
@@ -48,6 +55,7 @@ static unsigned int StringToWord(const char *string)
return(word);
}
#pragma GCC visibility push(default)
espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log)
{
char *p;
@@ -133,3 +141,4 @@ espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log)
fprintf(log, "Mbrola translation file: %s -- %d phonemes\n", buf, count);
return ENS_OK;
}
#pragma GCC visibility pop