mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-23 12:05:47 +00:00
[1.31.12]
Fix: reset phoneme table if speech is cancelled while switched to a second language. "speak": add -z options (same as for "espeak"). Numbers: Add option to speak "and" before hundreds. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@143 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+4
-2
@@ -1,3 +1,5 @@
|
||||
# removed -fno-exceptions because it caused problems with stdio library on some platforms
|
||||
|
||||
PREFIX=/
|
||||
BINDIR=$(PREFIX)/usr/bin
|
||||
INCDIR=$(PREFIX)/usr/include/espeak
|
||||
@@ -66,7 +68,7 @@ all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
|
||||
$(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c $<
|
||||
|
||||
$(BIN_NAME): $(OBJS1)
|
||||
$(CXX) -o $@ $(OBJS1) $(LIBS1)
|
||||
@@ -78,7 +80,7 @@ $(BIN2_NAME): $(OBJS3) $(LIB_NAME)
|
||||
|
||||
x_%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -Wall -fpic -pedantic \
|
||||
-I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o
|
||||
-I. -D LIBRARY -c $< -o x_$*.o
|
||||
|
||||
$(LIB_NAME): $(OBJS2)
|
||||
$(CXX) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ $(OBJS2) $(LIBS2)
|
||||
|
||||
+8
-1
@@ -454,6 +454,7 @@ int Translator::LookupNum3(int value, char *ph_out, int suppress_null, int thous
|
||||
char ph_digits[50];
|
||||
char ph_thousands[50];
|
||||
char ph_hundred_and[12];
|
||||
char ph_thousand_and[12];
|
||||
|
||||
hundreds = value / 100;
|
||||
buf1[0] = 0;
|
||||
@@ -461,6 +462,7 @@ int Translator::LookupNum3(int value, char *ph_out, int suppress_null, int thous
|
||||
if(hundreds > 0)
|
||||
{
|
||||
ph_thousands[0] = 0;
|
||||
ph_thousand_and[0] = 0;
|
||||
|
||||
Lookup("_0C",ph_100);
|
||||
|
||||
@@ -486,6 +488,11 @@ int Translator::LookupNum3(int value, char *ph_out, int suppress_null, int thous
|
||||
ph_digits[0] = 0;
|
||||
if(hundreds > 0)
|
||||
{
|
||||
if((langopts.numbers & 0x100000) && (prev_thousands || (ph_thousands[0] != 0)))
|
||||
{
|
||||
Lookup("_0and",ph_thousand_and);
|
||||
}
|
||||
|
||||
suppress_null = 1;
|
||||
|
||||
found = 0;
|
||||
@@ -513,7 +520,7 @@ int Translator::LookupNum3(int value, char *ph_out, int suppress_null, int thous
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buf1,"%s%s%s",ph_thousands,ph_digits,ph_100);
|
||||
sprintf(buf1,"%s%s%s%s",ph_thousands,ph_thousand_and,ph_digits,ph_100);
|
||||
}
|
||||
|
||||
ph_hundred_and[0] = 0;
|
||||
|
||||
@@ -127,6 +127,7 @@ typedef struct {
|
||||
// Several phoneme tables may be loaded into memory. phoneme_tab points to
|
||||
// one for the current voice
|
||||
extern int n_phoneme_tab;
|
||||
extern int current_phoneme_table;
|
||||
extern PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
|
||||
extern unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited
|
||||
|
||||
|
||||
+7
-1
@@ -91,6 +91,7 @@ static const char *help_text =
|
||||
"-q\t Quiet, don't produce any speech (may be useful with -x)\n"
|
||||
"-x\t Write phoneme mnemonics to stdout\n"
|
||||
"-X\t Write phonemes mnemonics and translation trace to stdout\n"
|
||||
"-z\t No final sentence pause at the end of the text\n"
|
||||
"--stdout Write speech output to stdout\n"
|
||||
"--compile=<voice name>\n"
|
||||
"\t Compile the pronunciation rules and dictionary in the current\n"
|
||||
@@ -500,6 +501,7 @@ int main (int argc, char **argv)
|
||||
option_phonemes = 0;
|
||||
option_waveout = 0;
|
||||
option_wordgap = 0;
|
||||
option_endpause = 1;
|
||||
option_multibyte = espeakCHARS_AUTO; // auto
|
||||
f_trans = stdout;
|
||||
|
||||
@@ -559,7 +561,7 @@ int main (int argc, char **argv)
|
||||
#else
|
||||
while(true)
|
||||
{
|
||||
c = getopt_long (argc, argv, "a:bf:g:hk:l:p:qs:v:w:xXm",
|
||||
c = getopt_long (argc, argv, "a:bf:g:hk:l:p:qs:v:w:xXmz",
|
||||
long_options, &option_index);
|
||||
|
||||
/* Detect the end of the options. */
|
||||
@@ -635,6 +637,10 @@ int main (int argc, char **argv)
|
||||
strncpy0(wavefile,optarg2,sizeof(wavefile));
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
option_endpause = 0;
|
||||
break;
|
||||
|
||||
case 0x100: // --stdin
|
||||
flag_stdin = 1;
|
||||
break;
|
||||
|
||||
+3
-1
@@ -35,13 +35,14 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.31.10 12.Feb.08";
|
||||
const char *version_string = "1.31.12 16.Feb.08";
|
||||
const int version_phdata = 0x013105;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
// copy the current phoneme table into here
|
||||
int n_phoneme_tab;
|
||||
int current_phoneme_table;
|
||||
PHONEME_TAB *phoneme_tab[N_PHONEME_TAB];
|
||||
unsigned char phoneme_tab_flags[N_PHONEME_TAB]; // bit 0: not inherited
|
||||
|
||||
@@ -574,6 +575,7 @@ void SelectPhonemeTable(int number)
|
||||
n_phoneme_tab = 0;
|
||||
SetUpPhonemeTable(number,0); // recursively for included phoneme tables
|
||||
n_phoneme_tab++;
|
||||
current_phoneme_table = number;
|
||||
} // end of SelectPhonemeTable
|
||||
|
||||
|
||||
|
||||
@@ -1544,6 +1544,11 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(current_phoneme_table != voice->phoneme_tab_ix)
|
||||
{
|
||||
SelectPhonemeTable(voice->phoneme_tab_ix);
|
||||
}
|
||||
|
||||
// read the next clause from the input text file, translate it, and generate
|
||||
// entries in the wavegen command queue
|
||||
p_text = translator->TranslateClause(f_text,p_text,&clause_tone,&voice_change);
|
||||
|
||||
@@ -440,6 +440,22 @@ SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
case L('k','u'): // Kurdish
|
||||
{
|
||||
static const unsigned char stress_amps_ku[8] = {16,16, 20,20, 20,24, 24,22 };
|
||||
static const short stress_lengths_ku[8] = {170,170, 190,170, 0,0, 230,240};
|
||||
|
||||
tr = new Translator();
|
||||
SetupTranslator(tr,stress_lengths_ku,stress_amps_ku);
|
||||
tr->charset_a0 = charsets[9]; // ISO-8859-9 - Latin5
|
||||
|
||||
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
|
||||
|
||||
tr->langopts.numbers = 0x100c69;
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case L('l','a'): //Latin
|
||||
{
|
||||
tr = new Translator();
|
||||
|
||||
+2
-1
@@ -316,7 +316,7 @@ typedef struct {
|
||||
// bit3= , decimal separator, not .
|
||||
// bit4=use three-and-twenty rather than twenty-three
|
||||
// bit5='and' between tens and units
|
||||
// bit6=add "and" after hundred and thousand
|
||||
// bit6=add "and" after hundred or thousand
|
||||
// bit7=don't have "and" both after hundreds and also between tens and units
|
||||
// bit8=only one primary stress in tens+units
|
||||
// bit9=only one vowel betwen tens and units
|
||||
@@ -328,6 +328,7 @@ typedef struct {
|
||||
// bit17=recognize roman numbers
|
||||
// bit18=Roman numbers only if upper case
|
||||
// bit19=don't add pause after a number
|
||||
// bit20='and' before hundreds
|
||||
int numbers;
|
||||
|
||||
// bits 1-4 use variant form of numbers before thousands,millions,etc.
|
||||
|
||||
Reference in New Issue
Block a user