[1.29.07] Reduce clicks at very low pitches due to numerical overflow in wave generation.

Treat echo-delay = 0 as "no echo", even if ech-amplitude is set.
lang=ru, fix crash for "words" which has produce no phonemes (wg. ":").


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@88 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-10-01 09:26:33 +00:00
parent 5671a4bd93
commit ca61663045
28 changed files with 128 additions and 137 deletions
+1 -1
View File
@@ -198,7 +198,7 @@
ie (_ ije
ii (_ iji
io (_ ijo
iu (_ ijo
iu (_ iju
_) i (on j
C) ight ajt // right, night
+1
View File
@@ -2481,6 +2481,7 @@ haves havz
has %ha2z $pastf $only
has haz $only $atend
(has been) %haz%bIn $pastf
(has to) haztU $atend
hath %haT $pastf $only
had %had $pastf $strend2 $only
(had been) %had%bIn $pastf
+3
View File
@@ -314,6 +314,9 @@ _szára) zs (ág zS
_kö) zs (ég zS
_nehé) zs (ely zS
_) zürich tsyR2iC
.group
$ dolla:R2
ä E
+39 -40
View File
@@ -1,9 +1,9 @@
38 phoneme tables
39 phoneme tables
new total
base 96 96
base2 23 114
en 53 144
en_n 29 144
en_n 30 144
en_us 37 144
en_sc 39 146
en_rp 34 144
@@ -38,6 +38,7 @@
vi 42 134
zhy 40 129
sw 14 105
en_x 33 144
3 b/b base hi ro
2 b/b_ base hi
@@ -107,8 +108,8 @@
1 l^/j2u base
1 l^/_l^ base
1 l^/l^ base
9 l/l base en af hu sk ru la pt ro
11 l/_l base en af de hu sk ru la pt ro
10 l/l base en af hu sk ru la pt ro en_x
12 l/_l base en af de hu sk ru la pt ro en_x
1 l/l_ base
2 l/l@ base
1 l/L1_aL base
@@ -131,7 +132,7 @@
4 l/l_long base fr la ro
2 l/lo base
2 l/lu base
9 l/tl base en af hu sk ru la pt ro
10 l/tl base en af hu sk ru la pt ro en_x
6 l/xl base
3 m/_m base ru ro
3 m/m_ base ru ro
@@ -272,14 +273,14 @@
2 ustop/ts_pzd_ hi hu
2 ustop/ts_pzd2 hi hu
2 vdiph/0i pt vi
2 vdiph/0i_2 en_sc no
2 vdiph2/e@ en_sc
3 vdiph/0i_2 en_sc no en_x
3 vdiph2/e@ en_sc en_x
1 vdiph2/ea ro
1 vdiph2/eo ro
1 vdiph2/e[u ro
1 vdiph2/i@ en_n
1 vdiph2/i@_2 en_wm
1 vdiph2/ie fi
2 vdiph2/ie fi en_x
1 vdiph2/ii@ en
1 vdiph2/ii@_3 vi
3 vdiph2/iu base2 vi zhy
@@ -289,11 +290,11 @@
1 vdiph2/iy fi
1 vdiph2/o@ af
1 vdiph2/oa ro
1 vdiph2/o_oo is
2 vdiph2/o_oo is en_x
1 vdiph2/u-@ vi
1 vdiph2/u#@ en_sc
1 vdiph2/uo fi
4 vdiph2/uu@ en en_n en_wm vi
5 vdiph2/uu@ en en_n en_wm vi en_x
1 vdiph2/y#@ af
1 vdiph2/yu nl
1 vdiph2/y-y# fi
@@ -302,12 +303,12 @@
2 vdiph/aai_2 af cy
1 vdiph/aai_3 fi
1 vdiph/aau fi
4 vdiph/aau_2 de nl la zhy
5 vdiph/aau_2 de nl la zhy en_x
1 vdiph/aau_3 hi
1 vdiph/aau_4 vi
1 vdiph/ae fr_ca
1 vdiph/ae_2 en_n
7 vdiph/ai base2 eo sk hr it pt vi
8 vdiph/ai base2 eo sk hr it pt vi en_x
2 vdiph/ai_2 cy
1 vdiph/ai_3 no
1 vdiph/ai_4 af
@@ -416,6 +417,7 @@
4 vowel/0_2 en_n en_wm pt_pt sw
4 vowel/0_3 en_us en_sc en_rp hu
2 vowel/@_2 fr
2 vowel/&_2 en_us
6 vowel/@_3 en_sc de hi
1 vowel/3_2 en_n
1 vowel/3_3 en_rp
@@ -423,13 +425,13 @@
1 vowel/@_4 nl
2 vowel/8_2 en_us sv
1 vowel/8_3 zhy
14 vowel/a en_n cy de hu nl pl sk hr sr it la
4 vowel/a# base2 en_sc pt
7 vowel/a_2 base2 eo la pt pt_pt ro vi
16 vowel/a en_n en_wm cy de hu nl pl sk hr sr it la
5 vowel/a# base2 en_sc pt en_x
11 vowel/a_2 base2 eo la pt pt_pt ro vi en_x
4 vowel/a#_2 hr sv is sw
7 vowel/a_3 en_sc fr cs is
12 vowel/a#_3 en en_n en_us en_wm de hi ru pt_pt vi zhy
4 vowel/a_4 en_wm el vi
2 vowel/a_4 el vi
3 vowel/a_5 it sv sw
5 vowel/aa fi fr_ca no zhy
1 vowel/aa# fi
@@ -442,41 +444,42 @@
2 vowel/aa_8 en_us
3 vowel/a_en en fr
1 vowel/@_bck hi
14 vowel/e base2 en en_n af cy eo fr hr it la pt pt_pt ++
15 vowel/e base2 en en_n af cy eo fr hr it la pt pt_pt ++
2 vowel/e# en_sc
7 vowel/e_2 en_sc de hi it sv no
1 vowel/e_3 hu
1 vowel/e_5 en_sc
3 vowel/ee fr pl sv
2 vowel/e_e en_sc is
8 vowel/ee_1 base2 en en_n pl la sv no zhy
3 vowel/ee_2 en cy nl
9 vowel/ee_1 base2 en en_n en_wm pl la sv no zhy
4 vowel/ee_2 en en_us cy nl
1 vowel/ee#_2 sv
4 vowel/ee_3 af pt vi
3 vowel/ee_6 en_n sk sv
13 vowel/e_mid en_rp en_wm fr_ca hi hu sk cs hr it es pt_pt no ++
13 vowel/e_mid en_rp fr_ca hi hu sk cs hr it es pt_pt no is ++
10 vowel/e_mid2 af de fi nl sk ro el sw
1 vowel/@_fnt hr
3 vowel/@_fnt hr en_x
1 vowel/@_hgh no
18 vowel/i base2 en_n en_rp en_wm cy eo fr hu pl it pt pt_pt ++
18 vowel/i base2 en_n en_wm cy eo fr hu pl it pt pt_pt ro ++
2 vowel/i# en_rp cy
5 vowel/i_2 de nl la sv
6 vowel/i_2 en_rp de nl la sv
3 vowel/i_3 af fr sk
4 vowel/i_4 fi hu it is
5 vowel/i_5 en_sc
3 vowel/i#_5 pt_pt ro
1 vowel/i_6 hr
3 vowel/i_en en en_us vi
2 vowel/i_fnt hi
3 vowel/i_fnt hi en_x
12 vowel/ii en_rp en_wm cy de fr_ca nl is zhy
3 vowel/ii# cy pl ru
1 vowel/ii_2 la
6 vowel/ii_3 fi hi sk hr sv no
7 vowel/ii_3 fi hi sk hr sv no en_x
5 vowel/ii_4 en en_n
2 vowel/ii_5 en_x
2 vowel/ii_6 en_wm
1 vowel/ii_en en
10 vowel/@_low en_rp hi ro no
11 vowel/o base2 en en_wm de hi it la pt_pt sv
12 vowel/o base2 en en_wm de hi it la pt_pt sv en_x
4 vowel/o_2 cy hi hu no
2 vowel/o-_2 en_n en_wm
3 vowel/o_3 en_sc fr
@@ -488,11 +491,11 @@
1 vowel/oe_2 no
1 vowel/oe_4 sv
2 vowel/o_mid fr hu
9 vowel/oo en_sc de eo la es el sv no zhy
11 vowel/oo_1 en_n en_rp en_wm af fi sk hr vi
12 vowel/oo en_sc de eo la es el sv no zhy en_x
10 vowel/oo_1 en_n en_rp en_wm af fi sk hr vi
3 vowel/oo_2 en_sc cy cs
1 vowel/oo_3 af
3 vowel/oo_4 hi pl it
6 vowel/oo_4 hi pl it en_x
1 vowel/oo_5 is
6 vowel/oo_en en en_n en_rp
2 vowelr/aa_r en_sc
@@ -501,7 +504,7 @@
4 vowelr/r-voc hi sk hr
2 vowelr/V3_r en en_sc
1 vowelr/V_r en
6 vowel/u cy de eo fr cs la
7 vowel/u cy de eo fr cs la en_x
5 vowel/u# en en_sc
5 vowel/u_2 fi fr sk hr ro
1 vowel/u#_2 sv
@@ -517,9 +520,9 @@
3 vowel/uu_2 base2 de la
1 vowel/uu_3 af
2 vowel/uu_4 fi sv
8 vowel/uu_bck en_n fr_ca hi hu pt no zhy
9 vowel/uu_bck en_n fr_ca hi hu pt no zhy en_x
1 vowel/V en_sc
4 vowel/V_2 en af ru
5 vowel/V_2 en en_us af ru
3 vowel/V_3 en_rp hi vi
1 vowel/V_4 en_sc
6 vowel/y en de fi hu nl zhy
@@ -538,13 +541,13 @@
1 vwl_af/@ af
1 vwl_af/I af
2 vwl_af/r@ af
6 vwl_en/aI@ en en_n en_us en_sc en_rp en_wm
7 vwl_en/aI@ en en_n en_us en_sc en_rp en_wm en_x
2 vwl_en/aI@_2 en_sc
5 vwl_en/aU@ en en_n en_us en_sc en_wm
6 vwl_en/aU@ en en_n en_us en_sc en_wm en_x
12 vwl_en/@L en en_us en_sc en_rp en_wm af
3 vwl_en/@L_2 en_sc
1 vwl_en_n/aa_5 en_n
1 vwl_en_n/O@ en_n
2 vwl_en_n/O@ en_n
1 vwl_en_n/u_ en_n
3 vwl_en_rp/aa en_rp
1 vwl_en_rp/aU@ en_rp
@@ -554,10 +557,8 @@
1 vwl_en/u en
4 vwl_en/u_L en en_n en_us en_rp
2 vwl_en_us/3_us en_us
2 vwl_en_us/a en_us
1 vwl_en_us/aai en_us
2 vwl_en_us/ar en_us
1 vwl_en_us/ee en_us
1 vwl_en_us/er en_us
1 vwl_en_us/i_final3 en_us
2 vwl_en_us/ii en_us
@@ -566,11 +567,9 @@
1 vwl_en_us/oor en_us
3 vwl_en_us/or en_us en_sc
1 vwl_en_us/ur en_us
1 vwl_en_us/V en_us
1 vwl_en_wm/i en_wm
2 vwl_fr/@R fr pt_pt
3 vwl_fr/@R fr pt_pt
1 vwl_fr/@R2 fr_ca
1 vwl_fr/rfr fr
1 vwl_hi/A hi
3 vwl_hi/l-voc hi sk
2 vwl_no/& no
+2 -2
View File
@@ -132,12 +132,12 @@ endphoneme
phoneme O@
vowel starttype (o) endtype (@)
length 240
formants vowel/oo_1
formants vwl_en_n/O@
linkout r-
endphoneme
phoneme O@
phoneme o@
vowel starttype (o) endtype (@)
length 240
formants vwl_en_n/O@
+1 -1
View File
@@ -160,7 +160,7 @@ endphoneme
phoneme i:
vowel starttype (i) endtype (i)
length 175
formants vowel/i
formants vowel/i_2
after w w/wi2
linkout ;
endphoneme
+8 -6
View File
@@ -53,8 +53,9 @@ endphoneme
phoneme a
vowel starttype (a) endtype (@)
length 190
formants vwl_en_us/a
length 180
formants vowel/&_2
// formants vwl_en_us/a
reduceto a2 0
endphoneme
@@ -62,7 +63,8 @@ endphoneme
phoneme aa // 'bath' etc.
vowel starttype (a) endtype (@)
length 190
formants vwl_en_us/a
formants vowel/&_2
// formants vwl_en_us/a
linkout r-
endphoneme
@@ -79,7 +81,7 @@ endphoneme
phoneme E
vowel starttype (e) endtype (e)
length 160
formants vwl_en_us/ee
formants vowel/ee_2
reduceto I 0
endphoneme
@@ -120,8 +122,8 @@ endphoneme
phoneme V
vowel starttype (a) endtype (@)
length 170
formants vwl_en_us/V
// formants vowel/V_2
// formants vwl_en_us/V
formants vowel/V_2
reduceto @ 0
endphoneme
+4 -4
View File
@@ -18,7 +18,7 @@ endphoneme
phoneme a
vowel starttype (a) endtype (a)
length 170
formants vowel/a_4
formants vowel/a
reduceto a2 0
endphoneme
@@ -26,9 +26,8 @@ endphoneme
phoneme E
vowel starttype (e) endtype (e)
length 150
formants vowel/e_mid
formants vowel/ee_1
reduceto I 0
// before l/ DFT-30+L/eL_af
endphoneme
@@ -79,6 +78,7 @@ phoneme U
vowel starttype (u) endtype (u)
length 150
formants vowel/uu
linkout _|
endphoneme
@@ -110,7 +110,7 @@ endphoneme
phoneme aa // 'bath' etc.
vowel starttype (a) endtype (a)
length 150
formants vowel/a_4
formants vowel/a
linkout r-
endphoneme
+4 -1
View File
@@ -619,7 +619,7 @@ endphoneme
phoneme d
vcd alv stop
vowelin f1=2 f2=1700 -300 300 f3=-100 80
vowelin f1=1 f2=1700 -300 300 f3=-100 80
vowelout f1=2 f2=1700 -300 300 f3=-100 80
formants d/d+x/d
before _ d/d_+x/d_
@@ -1241,4 +1241,7 @@ include ph_swahili
//phonemetable f_en basef
//include pf_english
phonemetable en_x en
include ph_english_x
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

+1 -48
View File
@@ -931,7 +931,6 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
int ix;
int v;
int v_stress;
int reduce_level;
int stressed_syllable; // position of stressed syllable
int max_stress_posn;
int unstressed_word = 0;
@@ -966,6 +965,7 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
if(phonetic[ix] == 0)
break;
}
if(ix == 0) return;
final_ph = phonetic[ix-1];
max_output = output + (N_WORD_PHONEMES-3); /* check for overrun */
@@ -1360,53 +1360,6 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
if(v_stress > 0)
*output++ = stress_phonemes[v_stress]; // mark stress of all vowels except 0 (unstressed)
while((ph->reduce_to != 0) && (((dictionary_flags & FLAG_FOUND)==0) || (langopts.param[LOPT_REDUCE] & 1)))
{
// this vowel can be reduced to another if the stress is below a specified value
int reduce = 0;
switch(reduce_level = (ph->phflags >> 28) & 7)
{
case 0:
/* reduce unstressed-diminished to schwa */
if((vowel_stress[v+1] <= 1) && (v >= (vowel_count-2)))
{
/* not if followed by another, terminating, unstessed syllable */
break;
} // drop through to next case
case 1:
if(v_stress == 1) // diminished stress only
reduce = 1;
break;
default:
if(v_stress < reduce_level)
reduce = 1;
break;
}
if(max_stress == 1) max_stress = 0;
if(unstressed_word && (langopts.param[LOPT_REDUCE] & 0x2) && (v_stress >= max_stress))
{
// don't reduce the most stressed syllable in an unstressed word
reduce = 0;
}
if(reduce)
{
phcode = ph->reduce_to;
ph = phoneme_tab[phcode];
#ifdef deleted
if(*p == phonLENGTHEN)
{
/* delete length indicator after vowel now that it has been reduced */
p++;
}
#endif
}
else
break;
}
if(vowel_stress[v] > max_stress)
{
+52 -20
View File
@@ -35,10 +35,6 @@
int Translator::ChangePhonemes(PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch)
{//======================================================================================================
// Called for each phoneme in the phoneme list, to allow a language to make changes
// flags: bit 0=1 last phoneme in a word
// bit 1=1 this is the highest stressed vowel in the current word
// bit 2=1 after the highest stressed vowel in the current word
// bit 3=1 the phonemes were specified explicitly, or found from an entry in the xx_list dictionary
// ph The current phoneme
return(0);
}
@@ -184,7 +180,7 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
PHONEME_TAB *ph;
PHONEME_TAB *prev, *next, *next2;
int unstress_count = 0;
int word_has_stress = 0;
int word_stress = 0;
int switched_language = 0;
int max_stress;
int voicing;
@@ -338,7 +334,21 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
}
if(plist2->sourceix)
word_has_stress = 0; // start of a word
{
// start of a word
int k;
word_stress = 0;
// find the highest stress level in this word
for(k=j+1; k < n_ph_list2; k++)
{
if(ph_list3[k].sourceix)
break; // start of the next word
if(ph_list3[k].stress > word_stress)
word_stress = ph_list3[k].stress;
}
}
if(ph == NULL) continue;
@@ -353,7 +363,7 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
{
// in a sequence of unstressed syllables, reduce alternate syllables to 'diminished'
// stress. But not for the last phoneme of a stressed word
if((langopts.stress_flags & 0x2) || (word_has_stress && ((plist2+1)->sourceix!=0)))
if((langopts.stress_flags & 0x2) || ((word_stress > 3) && ((plist2+1)->sourceix!=0)))
{
// An unstressed final vowel of a stressed word
unstress_count=1; // try again for next syllable
@@ -367,8 +377,6 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
else
{
unstress_count = 0;
if(plist2->stress > 3)
word_has_stress = 1; // word has a primary or a secondary stress
}
}
@@ -426,20 +434,44 @@ void Translator::MakePhonemeList(int post_pause, int start_sentence)
}
}
if((ph->reduce_to != 0) && (ph->type != phVOWEL) && !(plist2->synthflags & SFLAG_DICTIONARY))
{
// reduction for vowels has already been done in SetWordStress
int reduce_level;
if(next->type == phVOWEL)
while((ph->reduce_to != 0) && (!(plist2->synthflags & SFLAG_DICTIONARY) || (langopts.param[LOPT_REDUCE] & 1)))
{
int reduce_level;
int stress_level;
int reduce = 0;
reduce_level = (ph->phflags >> 28) & 7;
if(ph->type == phVOWEL)
{
reduce_level = (ph->phflags >> 28) & 7;
if((&plist2[1])->stress < reduce_level)
{
// look at the stress of the following vowel
ph = phoneme_tab[ph->reduce_to];
}
stress_level = plist2->stress;
}
else
{
// consonant, get stress from the following vowel
if(next->type == phVOWEL)
stress_level = (plist2+1)->stress;
else
break;
}
if(stress_level == 1)
reduce = 1; // stress = 'reduced'
if(stress_level < reduce_level)
reduce =1;
if((word_stress < 4) && (langopts.param[LOPT_REDUCE] & 0x2) && (stress_level >= word_stress))
{
// don't reduce the most stressed syllable in an unstressed word
reduce = 0;
}
if(reduce)
ph = phoneme_tab[ph->reduce_to];
else
break;
}
if((plist2+1)->synthflags & SFLAG_LENGTHEN)
-5
View File
@@ -744,11 +744,6 @@ typedef struct {
int Translator_Russian::ChangePhonemes(PHONEME_LIST2 *phlist, int n_ph, int index, PHONEME_TAB *ph, CHANGEPH *ch)
{//==============================================================================================================
// Called for each phoneme in the phoneme list, to allow a language to make changes
// flags: bit 0=1 last phoneme in a word
// bit 1=1 this is the highest stressed vowel in the current word
// bit 2=1 after the highest stressed vowel in the current word
// bit 3=1 the phonemes were specified explicitly, or found from an entry in the xx_list dictionary
// bits 8-15 syllable number, 1=first syllable, etc.
// ph The current phoneme
int variant;
+1 -1
View File
@@ -923,7 +923,7 @@ strcpy(phonemes2,phonemes);
if(last_char == 'f')
TranslateRules(&word_ss[1], phonemes, N_WORD_PHONEMES, NULL, 0, 0);
else
if(strchr_w("hsx",last_char)==NULL)
if((last_char==0) || (strchr_w("hsx",last_char)==NULL))
TranslateRules(&word_zz[1], phonemes, N_WORD_PHONEMES, NULL, 0, 0);
else
TranslateRules(&word_iz[1], phonemes, N_WORD_PHONEMES, NULL, 0, 0);
+4 -4
View File
@@ -396,9 +396,9 @@ static void VoiceFormant(char *p)
// Set parameters for a formant
int ix;
int formant;
int freq = -1;
int height = -1;
int width = -1;
int freq = 100;
int height = 100;
int width = 100;
ix = sscanf(p,"%d %d %d %d",&formant,&freq,&height,&width);
if(ix < 2)
@@ -713,7 +713,7 @@ voice_t *LoadVoice(const char *vname, int control)
{
while(isspace(*p)) p++;
n = -1;
if((n = atoi(p)) > 0)
if(((n = atoi(p)) > 0) && (n < 32))
{
p++;
conditional_rules |= (1 << n);
+7 -4
View File
@@ -817,6 +817,9 @@ static void WavegenSetEcho(void)
amp = embedded_value[EMBED_H];
delay = 130;
}
if(delay == 0)
amp = 0;
echo_head = (delay * samplerate)/1000;
echo_amp = amp;
// compensate (partially) for increase in amplitude due to echo
@@ -893,7 +896,7 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
{
peak_harmonic[pk] = peaks[pk].freq / pitch;
x = peaks[pk].height >> 14;
peak_height[pk] = x * x * 5;
peak_height[pk] = (x * x * 5)/2;
// only use harmonics up to half the samplerate
if(peak_harmonic[pk] >= hmax_samplerate)
@@ -905,7 +908,7 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control)
for(h=0; h<=hmax; h++, f+=pitch)
{
x = htab[h] >> 15;
htab[h] = (x * x) >> 7;
htab[h] = (x * x) >> 8;
if((ix = (f >> 19)) < N_TONE_ADJUST)
{
@@ -1134,7 +1137,7 @@ static int Wavegen()
maxh2 = PeaksToHarmspect(peaks,pitch<<4,hspect[0],0);
// adjust amplitude to compensate for fewer harmonics at higher pitch
amplitude2 = (amplitude * pitch)/(100 << 12);
amplitude2 = (amplitude * pitch)/(100 << 11);
// switch sign of harmonics above about 900Hz, to reduce max peak amplitude
h_switch_sign = 890 / (pitch >> 12);
@@ -1181,7 +1184,7 @@ static int Wavegen()
cycle_count++;
// adjust amplitude to compensate for fewer harmonics at higher pitch
amplitude2 = (amplitude * pitch)/(100 << 12);
amplitude2 = (amplitude * pitch)/(100 << 11);
if(glottal_flag > 0)
{