mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 14:04:27 +00:00
Merge branch 'master' into build
This commit is contained in:
+4
-3
@@ -478,6 +478,7 @@ void DecodePhonemes(const char *inptr, char *outptr)
|
||||
PHONEME_TAB *ph;
|
||||
static const char *stress_chars = "==,,'* ";
|
||||
|
||||
sprintf(outptr,"* ");
|
||||
while((phcode = *inptr++) > 0)
|
||||
{
|
||||
if(phcode == 255)
|
||||
@@ -2464,9 +2465,9 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
if((option_phonemes == 2) && ((word_flags & FLAG_NO_TRACE)==0))
|
||||
{
|
||||
char wordbuf[120];
|
||||
int ix;
|
||||
unsigned int ix;
|
||||
|
||||
for(ix=0; ((c = p_start[ix]) != ' ') && (c != 0); ix++)
|
||||
for(ix=0; ((c = p_start[ix]) != ' ') && (c != 0) && (ix < (sizeof(wordbuf)-1)); ix++)
|
||||
{
|
||||
wordbuf[ix] = c;
|
||||
}
|
||||
@@ -3168,7 +3169,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
}
|
||||
if(dictionary_flags2 & FLAG_NOUN)
|
||||
{
|
||||
if(!tr->expect_noun)
|
||||
if((!tr->expect_noun) || (end_flags & SUFX_V))
|
||||
{
|
||||
/* don't use the 'noun' pronunciation unless we are
|
||||
expecting a noun */
|
||||
|
||||
+1
-1
@@ -1302,7 +1302,7 @@ static int LookupNum2(Translator *tr, int value, int control, char *ph_out)
|
||||
{
|
||||
Lookup(tr, "_0and", ph_and);
|
||||
|
||||
if(tr->langopts.numbers2 & NUM2_MULTIPLE_ORDINAL)
|
||||
if((control & 1) && (tr->langopts.numbers2 & NUM2_MULTIPLE_ORDINAL))
|
||||
ph_and[0] = 0;
|
||||
|
||||
if(tr->langopts.numbers & NUM_SWAP_TENS)
|
||||
|
||||
+14
-2
@@ -1376,11 +1376,12 @@ int AddNameData(const char *name, int wide)
|
||||
if(namedata_ix+len >= n_namedata)
|
||||
{
|
||||
// allocate more space for marker names
|
||||
if((vp = realloc(namedata, namedata_ix+len + 300)) == NULL)
|
||||
if((vp = realloc(namedata, namedata_ix+len + 1000)) == NULL)
|
||||
return(-1); // failed to allocate, original data is unchanged but ignore this new name
|
||||
// !!! Bug?? If the allocated data shifts position, then pointers given to user application will be invalid
|
||||
|
||||
namedata = (char *)vp;
|
||||
n_namedata = namedata_ix+len + 300;
|
||||
n_namedata = namedata_ix+len + 1000;
|
||||
}
|
||||
memcpy(&namedata[ix = namedata_ix],name,len);
|
||||
namedata_ix += len;
|
||||
@@ -2218,6 +2219,17 @@ f_input = f_in; // for GetC etc
|
||||
else
|
||||
if((c2 == '/') || iswalpha(c2))
|
||||
{
|
||||
// check for space in the output buffer for embedded commands produced by the SSML tag
|
||||
if(ix > (n_buf - 20))
|
||||
{
|
||||
// Perhaps not enough room, end the clause before the SSML tag
|
||||
UngetC(c2);
|
||||
ungot_char2 = c1;
|
||||
buf[ix] = ' ';
|
||||
buf[ix+1] = 0;
|
||||
return(CLAUSE_NONE);
|
||||
}
|
||||
|
||||
// SSML Tag
|
||||
n_xml_buf = 0;
|
||||
c1 = c2;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.45.28 24.May.11";
|
||||
const char *version_string = "1.45.31 25.Jun.11";
|
||||
const int version_phdata = 0x014500;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+11
-9
@@ -1209,12 +1209,14 @@ void DoMarker(int type, int char_posn, int length, int value)
|
||||
{//==========================================================
|
||||
// This could be used to return an index to the word currently being spoken
|
||||
// Type 1=word, 2=sentence, 3=named marker, 4=play audio, 5=end
|
||||
wcmdq[wcmdq_tail][0] = WCMD_MARKER;
|
||||
wcmdq[wcmdq_tail][1] = type;
|
||||
wcmdq[wcmdq_tail][2] = (char_posn & 0xffffff) | (length << 24);
|
||||
wcmdq[wcmdq_tail][3] = value;
|
||||
WcmdqInc();
|
||||
|
||||
if(WcmdqFree() > 5)
|
||||
{
|
||||
wcmdq[wcmdq_tail][0] = WCMD_MARKER;
|
||||
wcmdq[wcmdq_tail][1] = type;
|
||||
wcmdq[wcmdq_tail][2] = (char_posn & 0xffffff) | (length << 24);
|
||||
wcmdq[wcmdq_tail][3] = value;
|
||||
WcmdqInc();
|
||||
}
|
||||
} // end of DoMarker
|
||||
|
||||
|
||||
@@ -1354,12 +1356,12 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
p = &phoneme_list[ix];
|
||||
|
||||
if(p->type == phPAUSE)
|
||||
free_min = 5;
|
||||
free_min = 10;
|
||||
else
|
||||
if(p->type != phVOWEL)
|
||||
free_min = 10; // we need less Q space for non-vowels, and we need to generate phonemes after a vowel so that the pitch_length is filled in
|
||||
free_min = 15; // we need less Q space for non-vowels, and we need to generate phonemes after a vowel so that the pitch_length is filled in
|
||||
else
|
||||
free_min = MIN_WCMDQ; // 22
|
||||
free_min = MIN_WCMDQ; // 25
|
||||
|
||||
if(WcmdqFree() <= free_min)
|
||||
return(1); // wait
|
||||
|
||||
+2
-2
@@ -455,8 +455,8 @@ extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1];
|
||||
|
||||
|
||||
|
||||
#define N_WCMDQ 160
|
||||
#define MIN_WCMDQ 22 // need this many free entries before adding new phoneme
|
||||
#define N_WCMDQ 170
|
||||
#define MIN_WCMDQ 25 // need this many free entries before adding new phoneme
|
||||
|
||||
extern long wcmdq[N_WCMDQ][4];
|
||||
extern int wcmdq_head;
|
||||
|
||||
@@ -1243,6 +1243,7 @@ SetLengthMods(tr,3); // all equal
|
||||
#endif
|
||||
|
||||
case L('t','r'): // Turkish
|
||||
case L('a','z'): // Azerbaijan
|
||||
{
|
||||
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, 200,230, 0,0, 240,250};
|
||||
@@ -1253,7 +1254,14 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
|
||||
tr->langopts.stress_flags = 0x20; //no automatic secondary stress
|
||||
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
if(name2 == L('a','z'))
|
||||
{
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_ALLOW_SPACE | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
tr->langopts.numbers = NUM_SINGLE_STRESS | NUM_DECIMAL_COMMA | NUM_OMIT_1_HUNDRED | NUM_OMIT_1_THOUSAND | NUM_DFRACTION_2;
|
||||
}
|
||||
tr->langopts.max_initial_consonants = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
+7
-3
@@ -1550,10 +1550,14 @@ static void SetPitchFormants()
|
||||
if((pitch_value = embedded_value[EMBED_P]) > MAX_PITCH_VALUE)
|
||||
pitch_value = MAX_PITCH_VALUE;
|
||||
|
||||
factor = 256 + (25 * (pitch_value - 50))/50;
|
||||
for(ix=0; ix<=5; ix++)
|
||||
if(pitch_value > 50)
|
||||
{
|
||||
wvoice->freq[ix] = (wvoice->freq2[ix] * factor)/256;
|
||||
// only adjust if the pitch is higher than normal
|
||||
factor = 256 + (25 * (pitch_value - 50))/50;
|
||||
for(ix=0; ix<=5; ix++)
|
||||
{
|
||||
wvoice->freq[ix] = (wvoice->freq2[ix] * factor)/256;
|
||||
}
|
||||
}
|
||||
factor = embedded_value[EMBED_T]*3;
|
||||
wvoice->height[0] = (wvoice->height2[0] * (256 - factor*2))/256;
|
||||
|
||||
Reference in New Issue
Block a user