[1.48.05]

Updated eSpeak makefile to inherit compiler options.

Language Greek (el): recognize polytonic spelling.

Language changes: en, gu, it, pt, ta, ur.
Language phoneme changes: de [r],  hi [a:] [r].

Added phoneme table for Arabic.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@376 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2014-05-23 12:44:05 +00:00
parent 9efa9c2100
commit 24379e026d
45 changed files with 2728 additions and 1149 deletions
+5 -5
View File
@@ -93,13 +93,13 @@ SRCS3 = espeak.cpp
OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
LIBS3=-lstdc++ -L . -lespeak
CXXFLAGS=-O2
CXXFLAGS?=-O2
CXXFLAGS+=-fno-exceptions -pedantic -Wall
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
.cpp.o:
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -I. -c $<
$(BIN_NAME): $(OBJS1)
$(CXX) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS1)
@@ -110,8 +110,8 @@ $(BIN2_NAME): $(OBJS3) $(LIB_NAME)
x_%.o: %.cpp
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -fpic -fvisibility=hidden -pedantic \
-I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o
$(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -fpic -fvisibility=hidden \
-I. -D LIBRARY -c $< -o x_$*.o
$(LIB_NAME): $(OBJS2)
$(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \
+5
View File
@@ -121,6 +121,7 @@ static keywtab_t k_properties[] = {
{"isNasal", 0, phNASAL},
{"isLiquid", 0, phLIQUID},
{"isUStop", 0, phSTOP},
{"isVStop", 0, phVSTOP},
{"isVFricative", 0, phVFRICATIVE},
{"isPalatal", 0, i_isPalatal},
@@ -3498,6 +3499,10 @@ static void CompilePhonemeFiles()
strncpy0(current_fname,item_string,sizeof(current_fname));
linenum = 1;
}
else
{
error("Missing file: %s", item_string);
}
break;
case kPHONEMETABLE:
+1
View File
@@ -96,6 +96,7 @@ MNEM_TAB mnem_flags[] = {
{"$strend", 9}, // full stress if at end of clause
{"$strend2", 10}, // full stress if at end of clause, or only followed by unstressed
{"$unstressend",11}, // reduce stress at end of clause
{"$accent_before",12}, // used with accent names, say this accent name before the letter name
{"$abbrev", 13}, // use this pronuciation rather than split into letters
// language specific
+10 -5
View File
@@ -3583,8 +3583,10 @@ int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *f
extern char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
int Lookup(Translator *tr, const char *word, char *ph_out)
{//===================================================
int found;
{//=========================================================
// Look up in *_list, returns dictionary flags[0] and phonemes
int flags0;
unsigned int flags[2];
int say_as;
char *word1 = (char *)word;
@@ -3592,7 +3594,10 @@ int Lookup(Translator *tr, const char *word, char *ph_out)
flags[0] = 0;
flags[1] = FLAG_LOOKUP_SYMBOL;
found = LookupDictList(tr, &word1, ph_out, flags, FLAG_ALLOW_TEXTMODE, NULL);
if((flags0 = LookupDictList(tr, &word1, ph_out, flags, FLAG_ALLOW_TEXTMODE, NULL)) != 0)
{
flags0 = flags[0];
}
if(flags[0] & FLAG_TEXTMODE)
{
@@ -3600,11 +3605,11 @@ int Lookup(Translator *tr, const char *word, char *ph_out)
option_sayas = 0; // don't speak replacement word as letter names
text[0] = 0;
strncpy0(&text[1], word1, sizeof(text));
found = TranslateWord(tr, &text[1], 0, NULL, NULL);
flags0 = TranslateWord(tr, &text[1], 0, NULL, NULL);
strcpy(ph_out, word_phonemes);
option_sayas = say_as;
}
return(found);
return(flags0);
}
+21 -9
View File
@@ -73,15 +73,15 @@ static int number_control;
typedef struct {
const char *name;
int flags;
int accent_flags; // bit 0, say before the letter name
} ACCENTS;
// these are tokens to look up in the *_list file.
static ACCENTS accents_tab[] = {
{"_lig", 1},
{"_smc", 1}, // smallcap
{"_tur", 1}, // turned
{"_rev", 1}, // reversed
{"_smc", 0}, // smallcap
{"_tur", 0}, // turned
{"_rev", 0}, // reversed
{"_crl", 0}, // curl
{"_acu", 0}, // acute
@@ -419,6 +419,7 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
int accent_data = 0;
int accent1 = 0;
int accent2 = 0;
int flags1, flags2;
int basic_letter;
int letter2=0;
char ph_letter1[30];
@@ -456,19 +457,19 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
}
if(Lookup(tr, accents_tab[accent1].name, ph_accent1) != 0)
if((flags1 = Lookup(tr, accents_tab[accent1].name, ph_accent1)) != 0)
{
if(LookupLetter2(tr, basic_letter, ph_letter1) != 0)
{
if(accent2 != 0)
{
if(Lookup(tr, accents_tab[accent2].name, ph_accent2) == 0)
if((flags2 = Lookup(tr, accents_tab[accent2].name, ph_accent2)) == 0)
{
// break;
}
if(accents_tab[accent2].flags & 1)
if(flags2 & FLAG_ACCENT_BEFORE)
{
strcpy(ph_buf,ph_accent2);
ph_buf += strlen(ph_buf);
@@ -485,7 +486,7 @@ void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf)
{
if(accent1 == 0)
strcpy(ph_buf, ph_letter1);
else if((tr->langopts.accents & 1) || (accents_tab[accent1].flags & 1))
else if((tr->langopts.accents & 1) || (flags1 & FLAG_ACCENT_BEFORE) || (accents_tab[accent1].accent_flags & 1))
sprintf(ph_buf,"%s%c%c%s", ph_accent1, phonPAUSE_VSHORT, phonSTRESS_P, ph_letter1);
else
sprintf(ph_buf,"%c%s%c%s%c", phonSTRESS_2, ph_letter1, phonPAUSE_VSHORT, ph_accent1, phonPAUSE_VSHORT);
@@ -1684,7 +1685,18 @@ static int LookupNum2(Translator *tr, int value, int thousandplex, const int con
ph_tens[ix] = 0;
}
}
sprintf(ph_out,"%s%s%s",ph_tens, ph_digits, ph_ordinal);
if((tr->langopts.numbers2 & NUM2_ORDINAL_DROP_VOWEL) && (ph_ordinal[0] != 0))
{
ix = sprintf(ph_out,"%s%s", ph_tens, ph_digits);
if((ix > 0) && (phoneme_tab[(unsigned char)(ph_out[ix-1])]->type == phVOWEL))
ix--;
sprintf(&ph_out[ix], "%s", ph_ordinal);
}
else
{
sprintf(ph_out,"%s%s%s",ph_tens, ph_digits, ph_ordinal);
}
}
}
+2 -1
View File
@@ -767,6 +767,7 @@ static int adjustPitch(
}
/* Skip over a pitch period, and copy period/speed samples to the output */
/* NOTE: Only called if speed > 1.0f */
static int skipPitchPeriod(
sonicStream stream,
short *samples,
@@ -778,7 +779,7 @@ static int skipPitchPeriod(
if(speed >= 2.0f) {
newSamples = period/(speed - 1.0f);
} else if(speed > 1.0f) {
} else {
newSamples = period;
stream->remainingInputToCopy = period*(2.0f - speed)/(speed - 1.0f);
}
+3 -15
View File
@@ -455,17 +455,6 @@ static int initialise(void)
}
static void StopSpeak(int unused)
{//==============================
signal(SIGINT,SIG_IGN);
// DEBUG
// printf("\n*** Interrupting speech output (use Ctrl-D to actually quit).\n");
fflush(stdout);
SpeakNextClause(NULL,NULL,5);
signal(SIGINT,StopSpeak);
} // end of StopSpeak()
#ifdef NEED_GETOPT
struct option {
@@ -524,13 +513,15 @@ int main (int argc, char **argv)
char *optarg2;
int amp = 100; // default
int wordgap = 0;
int speaking = 0;
int flag_stdin = 0;
int flag_compile = 0;
int pitch_adjustment = 50;
espeak_VOICE voice_select;
char filename[200];
char voicename[40];
#ifdef USE_PORTAUDIO
int speaking = 0;
#endif
voicename[0] = 0;
mbrola_name[0] = 0;
@@ -898,9 +889,6 @@ int main (int argc, char **argv)
}
else
{
// Silence on ^C or SIGINT
// signal(SIGINT,StopSpeak);
// output sound using portaudio
WavegenInitSound();
+2 -2
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2005 to 2013 by Jonathan Duddington *
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.48.03 04.Mar.14";
const char *version_string = "1.48.05 23.May.14";
const int version_phdata = 0x014801;
int option_device_number = -1;
+6
View File
@@ -1345,6 +1345,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
int modulation;
int pre_voiced;
int free_min;
int value;
unsigned char *pitch_env=NULL;
unsigned char *amp_env;
PHONEME_TAB *ph;
@@ -1687,6 +1688,11 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
StartSyllable();
}
InterpretPhoneme(NULL, 0, p, &phdata, &worddata);
if((value = (phdata.pd_param[i_PAUSE_BEFORE] - p->prepause)) > 0)
{
DoPause(value, 1);
}
fmtp.std_length = phdata.pd_param[i_SET_LENGTH]*2;
fmtp.fmt_addr = phdata.sound_addr[pd_FMT];
fmtp.fmt_amp = phdata.sound_param[pd_FMT];
+10 -1
View File
@@ -51,6 +51,7 @@
#define OFFSET_ARMENIAN 0x530
#define OFFSET_HEBREW 0x590
#define OFFSET_ARABIC 0x600
#define OFFSET_SYRIAC 0x700
#define OFFSET_THAANA 0x780 // Divehi/Maldives
#define OFFSET_DEVANAGARI 0x900
#define OFFSET_BENGALI 0x980
@@ -78,6 +79,7 @@ ALPHABET alphabets [] = {
{"_hy", OFFSET_ARMENIAN, 0x530, 0x58f, L('h','y'), AL_WORDS},
{"_he", OFFSET_HEBREW, 0x590, 0x5ff, 0, 0},
{"_ar", OFFSET_ARABIC, 0x600, 0x6ff, 0, 0},
{"_syc", OFFSET_SYRIAC, 0x700, 0x74f, 0, 0},
{"_dv", OFFSET_THAANA, 0x780, 0x7bf, 0, 0},
{"_hi", OFFSET_DEVANAGARI, 0x900, 0x97f,L('h','i'), AL_WORDS},
{"_bn", OFFSET_BENGALI, 0x0980, 0x9ff, L('b','n'), AL_WORDS},
@@ -516,6 +518,9 @@ Translator *SelectTranslator(const char *name)
case L('a','r'): // Arabic
tr->transpose_min = 0x620; // for ar_list, use 6-bit character codes
tr->transpose_max = 0x65f;
tr->transpose_map = NULL;
tr->letter_bits_offset = OFFSET_ARABIC;
tr->langopts.numbers = NUM_SWAP_TENS | NUM_AND_UNITS | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_AND_HUNDRED | NUM_THOUSAND_AND | NUM_OMIT_1_THOUSAND;
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 1; // disable check for unpronouncable words
@@ -541,6 +546,7 @@ Translator *SelectTranslator(const char *name)
{
static const short stress_lengths_bn[8] = {180, 180, 210, 210, 0, 0, 230, 240};
static const unsigned char stress_amps_bn[8] = {18,18, 18,18, 20,20, 22,22 };
static const char bn_consonants2[3] = {0x70, 0x71, 0};
SetupTranslator(tr,stress_lengths_bn,stress_amps_bn);
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
@@ -551,6 +557,7 @@ Translator *SelectTranslator(const char *name)
SetIndicLetters(tr); // call this after setting OFFSET_BENGALI
SetLetterBitsRange(tr,LETTERGP_B,0x01,0x01); // candranindu
SetLetterBitsRange(tr,LETTERGP_F,0x3e,0x4c); // vowel signs, but not virama
SetLetterBits(tr,LETTERGP_C,bn_consonants2);
tr->langopts.numbers = NUM_SWAP_TENS;
tr->langopts.break_numbers = 0x24924aa8; // for languages which have numbers for 100,000 and 100,00,000, eg Hindi
@@ -779,6 +786,7 @@ Translator *SelectTranslator(const char *name)
static const unsigned char stress_amps_eu[8] = {16,16, 18,18, 18,18, 18,18 };
SetupTranslator(tr,stress_lengths_eu,stress_amps_eu);
tr->langopts.stress_rule = STRESSPOSN_2L; // ?? second syllable ??
tr->langopts.param[LOPT_SUFFIX] = 1;
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_HUNDRED_AND | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_VIGESIMAL;
}
break;
@@ -1417,7 +1425,7 @@ SetLengthMods(tr,3); // all equal
tr->langopts.param[LOPT_UNPRONOUNCABLE] = 0x76; // [v] don't count this character at start of word
tr->langopts.param[LOPT_ALT] = 2; // call ApplySpecialAttributes2() if a word has $alt or $alt2
tr->langopts.param[LOPT_IT_LENGTHEN] = 1; // remove lengthen indicator from unstressed syllables
tr->letter_bits['r'] |= 0x80; // add 'r' to letter group 7, vowels for Unpronouncable test
tr->letter_bits[(int)'r'] |= 0x80; // add 'r' to letter group 7, vowels for Unpronouncable test
tr->langopts.numbers = NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_SWAP_TENS | NUM_OMIT_1_HUNDRED | NUM_DFRACTION_2 | NUM_ORDINAL_DOT | NUM_ROMAN;
tr->langopts.numbers2 = 0x100; // plural forms of millions etc
tr->langopts.thousands_sep = ' '; // don't allow dot as thousands separator
@@ -1521,6 +1529,7 @@ SetLengthMods(tr,3); // all equal
{
tr->letter_bits_offset = OFFSET_TELUGU;
tr->langopts.numbers = 0x1;
tr->langopts.numbers2 = NUM2_ORDINAL_DROP_VOWEL;
}
SetIndicLetters(tr); // call this after setting OFFSET_
SetLetterBitsRange(tr,LETTERGP_B,0x4e,0x4e); // chillu-virama (unofficial)
+2 -2
View File
@@ -949,7 +949,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
found = LookupDictList(tr, &word1, phonemes, dictionary_flags, FLAG_ALLOW_TEXTMODE, wtab); // the original word
if((dictionary_flags[0] & (FLAG_ALLOW_DOT || FLAG_NEEDS_DOT)) && (wordx[1] == '.'))
if((dictionary_flags[0] & (FLAG_ALLOW_DOT | FLAG_NEEDS_DOT)) && (wordx[1] == '.'))
{
wordx[1] = ' '; // remove a Dot after this word
}
@@ -2070,7 +2070,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
if(pre_pause < 1)
pre_pause = 1;
}
if((flags & FLAG_PREPAUSE) && !(word_flags && (FLAG_LAST_WORD | FLAG_FIRST_WORD)) && !(wtab[-1].flags & FLAG_FIRST_WORD) && (tr->prepause_timeout == 0))
if((flags & FLAG_PREPAUSE) && !(word_flags & (FLAG_LAST_WORD | FLAG_FIRST_WORD)) && !(wtab[-1].flags & FLAG_FIRST_WORD) && (tr->prepause_timeout == 0))
{
// the word is marked in the dictionary list with $pause
if(pre_pause < 4) pre_pause = 4;
+3
View File
@@ -44,6 +44,7 @@
#define FLAG_STRESS_END2 0x400 // full stress if at end of clause, or only followed by unstressed
#define FLAG_UNSTRESS_END 0x800 // reduce stress at end of clause
#define FLAG_SPELLWORD 0x1000 // re-translate the word as individual letters, separated by spaces
#define FLAG_ACCENT_BEFORE 0x1000 // say this accent name before the letter name
#define FLAG_ABBREV 0x2000 // spell as letters, even with a vowel, OR use specified pronunciation rather than split into letters
#define FLAG_DOUBLING 0x4000 // doubles the following consonant
@@ -524,6 +525,7 @@ typedef struct {
#define NUM2_PERCENT_BEFORE 0x10000
#define NUM2_OMIT_1_HUNDRED_ONLY 0x20000
#define NUM2_ORDINAL_AND_THOUSANDS 0x40000
#define NUM2_ORDINAL_DROP_VOWEL 0x80000
// bits 1-4 use variant form of numbers before thousands,millions,etc.
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after
@@ -535,6 +537,7 @@ typedef struct {
// bit16=(LANG=si) say "%" before the number
// bit17=(LANG=ml) omit "one" before hundred only if there are no previous digits
// bit18=(LANG=ta) same variant for ordinals and thousands (#o = #a)
// bit19=(LANG=te) drop final vowel from cardial number before adding ordinal suffix
int numbers2;
#define BREAK_THOUSANDS 0x49249248
+1 -1
View File
@@ -610,7 +610,7 @@ voice_t *LoadVoice(const char *vname, int control)
// which directory to look for a named voice. List of voice names, must end in a space.
static const char *voices_asia =
"az bn fa fa-pin hi hy hy-west id ka kn ku ml ms ne pa ta te tr vi vi-hue vi-sgn zh zh-yue ";
"az bn fa fa-pin gu hi hy hy-west id ka kn ku ml ms ne pa ta te tr vi vi-hue vi-sgn zh zh-yue ";
static const char *voices_europe =
"an bg bs ca cs cy da de el en en-us es et fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";