mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 13:38:47 +00:00
Fix a numerical overflow in wavegen() which could cause distortion when a voice file increases the height of formant peaks.
git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@92 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ INCDIR=/usr/include/espeak
|
||||
LIBDIR=/usr/lib
|
||||
DATADIR=/usr/share/espeak-data
|
||||
|
||||
RELEASE = 1.24
|
||||
RELEASE = 1.29
|
||||
BIN_NAME = speak
|
||||
BIN2_NAME = espeak
|
||||
LIB_NAME = libespeak.so
|
||||
|
||||
+10
-19
@@ -187,6 +187,7 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
int regression;
|
||||
int end_sourceix;
|
||||
int alternative;
|
||||
int first_vowel=0; // first vowel in a word
|
||||
PHONEME_LIST2 ph_list3[N_PHONEME_LIST];
|
||||
|
||||
static PHONEME_LIST2 ph_list2_null = {0,0,0,0,0};
|
||||
@@ -210,12 +211,12 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
// the last word is unstressed, look for a previous word that can be stressed
|
||||
while(--j >= 0)
|
||||
{
|
||||
if(ph_list2[j].stress & 0x80) // dictionary flags indicated that this stress can be promoted
|
||||
if(ph_list2[j].synthflags & SFLAG_PROMOTE_STRESS) // dictionary flags indicated that this stress can be promoted
|
||||
{
|
||||
ph_list2[j].stress = 4; // promote to stressed
|
||||
break;
|
||||
}
|
||||
if((ph_list2[j].stress & 0x7f) >= 4)
|
||||
if(ph_list2[j].stress >= 4)
|
||||
{
|
||||
// found a stressed syllable, so stop looking
|
||||
break;
|
||||
@@ -338,6 +339,7 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
// start of a word
|
||||
int k;
|
||||
word_stress = 0;
|
||||
first_vowel = 1;
|
||||
|
||||
// find the highest stress level in this word
|
||||
for(k=j+1; k < n_ph_list2; k++)
|
||||
@@ -456,6 +458,9 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
break;
|
||||
}
|
||||
|
||||
if((stress_level == 1) && (first_vowel))
|
||||
stress_level = 0; // ignore 'dimished' stress on first syllable
|
||||
|
||||
if(stress_level == 1)
|
||||
reduce = 1; // stress = 'reduced'
|
||||
|
||||
@@ -474,6 +479,9 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
break;
|
||||
}
|
||||
|
||||
if(ph->type == phVOWEL)
|
||||
first_vowel = 0;
|
||||
|
||||
if((plist2+1)->synthflags & SFLAG_LENGTHEN)
|
||||
{
|
||||
static char types_double[] = {phFRICATIVE,phVFRICATIVE,phNASAL,phLIQUID,0};
|
||||
@@ -520,23 +528,6 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
|
||||
|
||||
next2 = phoneme_tab[(plist2+2)->phcode];
|
||||
|
||||
#ifdef deleted
|
||||
if((ph->type != phVOWEL) && (ph->type != phPAUSE) //&& ((ph->phflags & phVOICED)==0)
|
||||
&& (next->type == phLIQUID) && (next->mnemonic != ';') && (next2->type != phVOWEL))
|
||||
{
|
||||
// semi-vowel surrounded by consonants. precede by a short schwa
|
||||
insert_ph = phonSCHWA_SHORT;
|
||||
insert_synthflags = SFLAG_SYLLABLE;
|
||||
}
|
||||
|
||||
if((ph->type == phLIQUID) && (prev->type != phVOWEL) && (next->type != phVOWEL))
|
||||
{
|
||||
// semi-vowel surrounded by consonants. precede by a short schwa
|
||||
insert_ph = phonSCHWA_SHORT;
|
||||
insert_synthflags = SFLAG_SYLLABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if((insert_ph == 0) && (ph->link_out != 0) && (((plist2+1)->synthflags & SFLAG_EMBEDDED)==0))
|
||||
{
|
||||
if(ph->phflags & phAPPENDPH)
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
#define SFLAG_LENGTHEN 0x08 // lengthen symbol : included after this phoneme
|
||||
#define SFLAG_DICTIONARY 0x10 // the pronunciation of this word was listed in the xx_list dictionary
|
||||
#define SFLAG_SWITCHED_LANG 0x20 // this word uses phonemes from a different language
|
||||
|
||||
#define SFLAG_PROMOTE_STRESS 0x40 // this unstressed word can be promoted to stressed
|
||||
|
||||
// embedded command numbers
|
||||
#define EMBED_P 1 // pitch
|
||||
|
||||
+1
-1
@@ -1494,7 +1494,7 @@ int Translator::TranslateWord2(char *word, WORD_TAB *wtab, int pre_pause, int ne
|
||||
if(flags & FLAG_STRESS_END2)
|
||||
{
|
||||
// this's word's stress could be increased later
|
||||
ph_list2[max_stress_ix].stress |= 0x80;
|
||||
ph_list2[max_stress_ix].synthflags |= SFLAG_PROMOTE_STRESS;
|
||||
}
|
||||
|
||||
prev_dict_flags = flags;
|
||||
|
||||
+1
-1
@@ -1341,7 +1341,7 @@ static int Wavegen()
|
||||
z2 = (z2 * mix_wave_amp)/32;
|
||||
}
|
||||
|
||||
z1 = z2 + (((total>>7) * amplitude2) >> 14);
|
||||
z1 = z2 + (((total>>8) * amplitude2) >> 13);
|
||||
|
||||
echo = (echo_buf[echo_tail++] * echo_amp);
|
||||
z1 += echo >> 8;
|
||||
|
||||
Reference in New Issue
Block a user