mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 14:04:27 +00:00
Merge branch 'development' into build
This commit is contained in:
+3
-2
@@ -44,6 +44,7 @@
|
||||
extern void FindPhonemesUsed(void);
|
||||
extern void DisplayErrorFile(const char *fname);
|
||||
extern int utf8_out(unsigned int c, char *buf);
|
||||
extern void DrawEnvelopes();
|
||||
char path_source[sizeof(path_home)+20];
|
||||
|
||||
|
||||
@@ -3503,9 +3504,9 @@ fprintf(f_errors,"\nRefs %d, Reused %d\n",count_references,duplicate_references
|
||||
|
||||
CompileReport();
|
||||
report_dict = CompileAllDictionaries();
|
||||
#ifdef deleted
|
||||
//#ifdef deleted
|
||||
DrawEnvelopes();
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
if(gui_flag)
|
||||
{
|
||||
|
||||
+35
-1
@@ -879,6 +879,18 @@ static int group3_ix;
|
||||
|
||||
|
||||
|
||||
int isHexDigit(int c)
|
||||
{
|
||||
if((c >= '0') && (c <= '9'))
|
||||
return(c - '0');
|
||||
if((c >= 'a') && (c <= 'f'))
|
||||
return(c - 'a' + 10);
|
||||
if((c >= 'A') && (c <= 'F'))
|
||||
return(c - 'A' + 10);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
static void copy_rule_string(char *string, int &state)
|
||||
{//===================================================
|
||||
// state 0: conditional, 1=pre, 2=match, 3=post, 4=phonemes
|
||||
@@ -889,9 +901,11 @@ static void copy_rule_string(char *string, int &state)
|
||||
int ix;
|
||||
int len;
|
||||
char c;
|
||||
int c2, c3;
|
||||
int sxflags;
|
||||
int value;
|
||||
int literal;
|
||||
int hexdigit_input = 0;
|
||||
MNEM_TAB *mr;
|
||||
|
||||
if(string[0] == 0) return;
|
||||
@@ -911,18 +925,38 @@ static void copy_rule_string(char *string, int &state)
|
||||
{
|
||||
literal = 0;
|
||||
c = *p++;
|
||||
if((c == '0') && (p[0] == 'x') && (isHexDigit(p[1]) >= 0) && (isHexDigit(p[2]) >= 0))
|
||||
{
|
||||
hexdigit_input = 1;
|
||||
c = p[1];
|
||||
p+= 2;
|
||||
}
|
||||
if(c == '\\')
|
||||
{
|
||||
c = *p++; // treat next character literally
|
||||
//#ifdef deleted
|
||||
if((c >= '0') && (c <= '3') && (p[0] >= '0') && (p[0] <= '7') && (p[1] >= '0') && (p[1] <= '7'))
|
||||
{
|
||||
// character code given by 3 digit octal value;
|
||||
c = (c-'0')*64 + (p[0]-'0')*8 + (p[1]-'0');
|
||||
p += 2;
|
||||
}
|
||||
//endif
|
||||
literal = 1;
|
||||
}
|
||||
|
||||
if(hexdigit_input)
|
||||
{
|
||||
if(((c2 = isHexDigit(c)) >= 0) && ((c3 = isHexDigit(p[0])) >= 0))
|
||||
{
|
||||
c = c2 * 16 + c3;
|
||||
literal = 1;
|
||||
p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
hexdigit_input = 0;
|
||||
}
|
||||
}
|
||||
if((state==1) || (state==3))
|
||||
{
|
||||
// replace special characters (note: 'E' is reserved for a replaced silent 'e')
|
||||
|
||||
+19
-9
@@ -60,7 +60,7 @@ static void* say_thread(void*);
|
||||
|
||||
static espeak_ERROR push(t_espeak_command* the_command);
|
||||
static t_espeak_command* pop();
|
||||
static void init();
|
||||
static void init(int process_parameters);
|
||||
static int node_counter=0;
|
||||
enum {MAX_NODE_COUNTER=400,
|
||||
INACTIVITY_TIMEOUT=50, // in ms, check that the stream is inactive
|
||||
@@ -75,7 +75,7 @@ void fifo_init()
|
||||
|
||||
// security
|
||||
pthread_mutex_init( &my_mutex, (const pthread_mutexattr_t *)NULL);
|
||||
init();
|
||||
init(0);
|
||||
|
||||
assert(-1 != sem_init(&my_sem_start_is_required, 0, 0));
|
||||
assert(-1 != sem_init(&my_sem_stop_is_acknowledged, 0, 0));
|
||||
@@ -457,7 +457,7 @@ static void* say_thread(void*)
|
||||
{
|
||||
// no mutex required since the stop command is synchronous
|
||||
// and waiting for my_sem_stop_is_acknowledged
|
||||
init();
|
||||
init(1);
|
||||
|
||||
// purge start semaphore
|
||||
SHOW_TIME("say_thread > purge my_sem_start_is_required\n");
|
||||
@@ -569,14 +569,24 @@ static t_espeak_command* pop()
|
||||
}
|
||||
|
||||
|
||||
static void init()
|
||||
static void init(int process_parameters)
|
||||
{
|
||||
ENTER("fifo > init");
|
||||
while (delete_espeak_command( pop() ))
|
||||
{}
|
||||
node_counter = 0;
|
||||
// Changed by Tyler Spivey 30.Nov.2011
|
||||
t_espeak_command *c = NULL;
|
||||
ENTER("fifo > init");
|
||||
c = pop();
|
||||
while (c != NULL) {
|
||||
if (process_parameters && (c->type == ET_PARAMETER || c->type == ET_VOICE_NAME || c->type == ET_VOICE_SPEC))
|
||||
{
|
||||
process_espeak_command(c);
|
||||
}
|
||||
delete_espeak_command(c);
|
||||
c = pop();
|
||||
}
|
||||
node_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
//>
|
||||
//<fifo_init
|
||||
void fifo_terminate()
|
||||
@@ -589,7 +599,7 @@ void fifo_terminate()
|
||||
sem_destroy(&my_sem_start_is_required);
|
||||
sem_destroy(&my_sem_stop_is_acknowledged);
|
||||
|
||||
init(); // purge fifo
|
||||
init(0); // purge fifo
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+6
-2
@@ -1862,15 +1862,19 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
|
||||
case NUM_DFRACTION_1: // italian, say "hundredths" if leading zero
|
||||
case NUM_DFRACTION_5: // hungarian, always say "tenths" etc.
|
||||
case NUM_DFRACTION_6: // kazakh, always say "tenths" etc, before the decimal fraction
|
||||
LookupNum3(tr, atoi(&word[n_digits]), ph_buf, 0,0,0);
|
||||
if((word[n_digits]=='0') || (decimal_mode == NUM_DFRACTION_5))
|
||||
if((word[n_digits]=='0') || (decimal_mode != NUM_DFRACTION_1))
|
||||
{
|
||||
// decimal part has leading zeros, so add a "hundredths" or "thousandths" suffix
|
||||
sprintf(string,"_0Z%d",decimal_count);
|
||||
if(Lookup(tr, string, buf1) == 0)
|
||||
break; // revert to speaking single digits
|
||||
|
||||
strcat(ph_buf,buf1);
|
||||
if(decimal_mode == NUM_DFRACTION_6)
|
||||
strcat(ph_out, buf1);
|
||||
else
|
||||
strcat(ph_buf, buf1);
|
||||
}
|
||||
strcat(ph_out,ph_buf);
|
||||
n_digits += decimal_count;
|
||||
|
||||
+5
-4
@@ -715,14 +715,14 @@ if(stress <= 1)
|
||||
if(stress >= 7)
|
||||
{
|
||||
// tonic syllable, include a constant component so it doesn't decrease directly with speed
|
||||
length_mod += 20;
|
||||
length_mod += tr->langopts.lengthen_tonic;
|
||||
if(emphasized)
|
||||
length_mod += 10;
|
||||
length_mod += (tr->langopts.lengthen_tonic/2);
|
||||
}
|
||||
else
|
||||
if(emphasized)
|
||||
{
|
||||
length_mod += 20;
|
||||
length_mod += tr->langopts.lengthen_tonic;
|
||||
}
|
||||
|
||||
if((len = tr->stress_lengths[stress]) == 0)
|
||||
@@ -739,7 +739,8 @@ if(stress <= 1)
|
||||
}
|
||||
}
|
||||
|
||||
if(end_of_clause == 2)
|
||||
|
||||
if((end_of_clause == 2) && !(tr->langopts.stress_flags & S_NO_EOC_LENGTHEN))
|
||||
{
|
||||
// this is the last syllable in the clause, lengthen it - more for short vowels
|
||||
len = (p->ph->std_length * 2);
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.06 29.Nov.11";
|
||||
const char *version_string = "1.46.09 09.Dec.11";
|
||||
const int version_phdata = 0x014600;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+32
-5
@@ -164,6 +164,7 @@ static Translator* NewTranslator(void)
|
||||
}
|
||||
memset(&(tr->langopts),0,sizeof(tr->langopts));
|
||||
tr->langopts.max_lengthmod = 500;
|
||||
tr->langopts.lengthen_tonic = 20;
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_2R;
|
||||
tr->langopts.unstressed_wd1 = 1;
|
||||
@@ -274,11 +275,13 @@ static const unsigned int replace_cyrillic_latin[] =
|
||||
0x45c,0x107,
|
||||
0}; // ѓ ѕ ќ
|
||||
|
||||
|
||||
static const unsigned char ru_vowels[] = {0x10,0x15,0x31,0x18,0x1e,0x23,0x2b,0x2d,0x2e,0x2f, 0xb9,0xc9,0x91,0x8f,0x36,0}; //also kazakh
|
||||
static const unsigned char ru_consonants[] = {0x11,0x12,0x13,0x14,0x16,0x17,0x19,0x1a,0x1b,0x1c,0x1d,0x1f,0x20,0x21,0x22,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2c, 0x73,0x7b,0x83,0x9b,0};
|
||||
|
||||
static void SetCyrillicLetters(Translator *tr)
|
||||
{//===========================================
|
||||
// character codes offset by 0x420
|
||||
static const char ru_vowels[] = {0x10,0x15,0x31,0x18,0x1e,0x23,0x2b,0x2d,0x2e,0x2f,0};
|
||||
static const char ru_consonants[] = {0x11,0x12,0x13,0x14,0x16,0x17,0x19,0x1a,0x1b,0x1c,0x1d,0x1f,0x20,0x21,0x22,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2c,0};
|
||||
static const char ru_soft[] = {0x2c,0x19,0x27,0x29,0}; // letter group B [k ts; s;]
|
||||
static const char ru_hard[] = {0x2a,0x16,0x26,0x28,0}; // letter group H [S Z ts]
|
||||
static const char ru_nothard[] = {0x11,0x12,0x13,0x14,0x17,0x19,0x1a,0x1b,0x1c,0x1d,0x1f,0x20,0x21,0x22,0x24,0x25,0x27,0x29,0x2c,0};
|
||||
@@ -291,14 +294,14 @@ static void SetCyrillicLetters(Translator *tr)
|
||||
|
||||
tr->letter_bits_offset = OFFSET_CYRILLIC;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBits(tr,LETTERGP_A,ru_vowels);
|
||||
SetLetterBits(tr,LETTERGP_A,(char *)ru_vowels);
|
||||
SetLetterBits(tr,1,ru_soft);
|
||||
SetLetterBits(tr,2,ru_consonants);
|
||||
SetLetterBits(tr,2,(char *)ru_consonants);
|
||||
SetLetterBits(tr,3,ru_hard);
|
||||
SetLetterBits(tr,4,ru_nothard);
|
||||
SetLetterBits(tr,5,ru_voiced);
|
||||
SetLetterBits(tr,6,ru_ivowels);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,ru_vowels);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,(char *)ru_vowels);
|
||||
} // end of SetCyrillicLetters
|
||||
|
||||
|
||||
@@ -893,6 +896,30 @@ SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
case L('k','k'): // Kazakh
|
||||
{
|
||||
static const unsigned char stress_amps_tr[8] = {18,16, 20,21, 20,21, 21,20 };
|
||||
static const short stress_lengths_tr[8] = {190,180, 230,230, 0,0, 250,250};
|
||||
|
||||
tr->letter_bits_offset = OFFSET_CYRILLIC;
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
SetLetterBits(tr,LETTERGP_A,(char *)ru_vowels);
|
||||
SetLetterBits(tr,LETTERGP_C,(char *)ru_consonants);
|
||||
SetLetterBits(tr,LETTERGP_VOWEL2,(char *)ru_vowels);
|
||||
|
||||
SetupTranslator(tr,stress_lengths_tr,stress_amps_tr);
|
||||
|
||||
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
|
||||
tr->langopts.stress_flags = S_NO_AUTO_2 + S_NO_EOC_LENGTHEN; //no automatic secondary stress, don't lengthen at end-of-clause
|
||||
tr->langopts.lengthen_tonic = 0;
|
||||
tr->langopts.param[LOPT_SUFFIX] = 1;
|
||||
|
||||
tr->langopts.numbers = NUM_OMIT_1_HUNDRED | NUM_DFRACTION_6 ;
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
case L('k','o'): // Korean, TEST
|
||||
{
|
||||
static const char ko_ivowels[] = {0x63,0x64,0x67,0x68,0x6d,0x72,0x74,0x75,0}; // y and i vowels
|
||||
|
||||
+10
-10
@@ -334,16 +334,16 @@ static unsigned char length_mods_en0[100] = {
|
||||
|
||||
static unsigned char length_mods_equal[100] = {
|
||||
/* a , t s n d z r N <- next */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* a <- next2 */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* , */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* t */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* s */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* n */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* d */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* z */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* r */
|
||||
110,110,110,110,110,110,110,110,110, 110, /* N */
|
||||
110,110,110,110,110,110,110,110,110, 110 }; // SPARE
|
||||
110,120,100,110,110,110,110,110,110, 110, /* a <- next2 */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* , */
|
||||
110,120,100,110,100,110,110,110,100, 110, /* t */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* s */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* n */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* d */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* z */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* r */
|
||||
110,120,100,110,110,110,110,110,110, 110, /* N */
|
||||
110,120,100,110,110,110,110,110,110, 110 }; // SPARE
|
||||
|
||||
|
||||
static unsigned char *length_mod_tabs[6] = {
|
||||
|
||||
+5
-1
@@ -355,6 +355,7 @@ typedef struct {
|
||||
#define S_INITIAL_2 0x2000
|
||||
#define S_NO_AUTO_DIM 0x10000
|
||||
#define S_HYPEN_UNSTRESS 0x100000
|
||||
#define S_NO_EOC_LENGTHEN 0x200000
|
||||
// bit0=don't stress monosyllables, except at end of clause
|
||||
// bit1=don't set diminished stress,
|
||||
// bit2=mark unstressed final syllables as diminished
|
||||
@@ -373,6 +374,7 @@ typedef struct {
|
||||
// bit18= don't lengthen short vowels more than long vowels at end-of-clause
|
||||
// bit19=stress on final syllable if it has a long vowel, but previous syllable has a short vowel
|
||||
// bit20= hyphenated words, 2nd part is unstressed
|
||||
// bit21= don't lengthen vowels at end-of-clause
|
||||
|
||||
int stress_flags;
|
||||
int unstressed_wd1; // stress for $u word of 1 syllable
|
||||
@@ -398,6 +400,7 @@ typedef struct {
|
||||
#define NUM_DFRACTION_3 0x6000
|
||||
#define NUM_DFRACTION_4 0x8000
|
||||
#define NUM_DFRACTION_5 0xa000
|
||||
#define NUM_DFRACTION_6 0xc000
|
||||
#define NUM_ORDINAL_DOT 0x10000
|
||||
#define NUM_NOPAUSE 0x20000
|
||||
#define NUM_AND_HUNDRED 0x40000
|
||||
@@ -476,7 +479,8 @@ typedef struct {
|
||||
const unsigned int *replace_chars; // characters to be substitutes
|
||||
const char *ascii_language; // switch to this language for Latin characters
|
||||
int max_lengthmod;
|
||||
int suffix_add_e; // replace a suffix (which has the SUFX_E flag) with this character
|
||||
int lengthen_tonic; // lengthen the tonic syllable
|
||||
int suffix_add_e; // replace a suffix (which has the SUFX_E flag) with this character
|
||||
} LANGUAGE_OPTIONS;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user