git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@97 d46cf337-b52f-0410-862d-fd96e6ae7743master
| @@ -346,6 +346,12 @@ x z Z | |||
| Dictionary zh_dict | |||
| @r a A ai E ei i i0 | |||
| i[ iou u | |||
| c; j k kh l n N p | |||
| ph R R2 R3 s tc; tc; th | |||
| ts ts. ts. tsh w | |||
| Dictionary zhh_dict | |||
| @@ -8,7 +8,10 @@ phonemes en_us | |||
| dictrules 3 6 | |||
| option 12 1 // reduce [t] | |||
| stressLength 150 125 180 180 0 0 270 300 | |||
| stressLength 150 125 180 180 0 0 270 280 | |||
| stressAmp 17 16 20 20 20 22 23 20 | |||
| //replace 03 I i | |||
| //replace 03 I2 i | |||
| formant 1 99 100 100 | |||
| @@ -272,7 +272,6 @@ l/L2_oL [(o)] base | |||
| l/L2_uL [(u)] base | |||
| [u:] en | |||
| [u:] en_n | |||
| [u:] en_us | |||
| [u:] en_rp | |||
| l/l_3 [l/] de | |||
| [l] fr | |||
| @@ -847,8 +846,7 @@ vdiph/eei [EI] base2 | |||
| [EI] de | |||
| [EI] nl | |||
| [EI] vi | |||
| vdiph/eei_2 [eI] en_us | |||
| [eI] eo | |||
| vdiph/eei_2 [eI] eo | |||
| [ei] fi | |||
| vdiph/eei_3 [eI] en_rp | |||
| [eI] sk | |||
| @@ -900,7 +898,6 @@ vdiph/oi [oI] base2 | |||
| vdiph/oi_2 [oI] af | |||
| vdiph/ooi [OI] en | |||
| [OI] en_n | |||
| [OI] en_us | |||
| [OI] cy | |||
| [OY] cy | |||
| [OI] eo | |||
| @@ -908,7 +905,8 @@ vdiph/ooi [OI] en | |||
| [OI] no | |||
| [oi] zhy | |||
| vdiph/ooi_2 [OI] af | |||
| vdiph/ooi_3 [OI] en_rp | |||
| vdiph/ooi_3 [OI] en_us | |||
| [OI] en_rp | |||
| [aI] en_wm | |||
| vdiph/oou [oU] cs | |||
| [OU] grc | |||
| @@ -1050,9 +1048,6 @@ vowel/@ [@] base | |||
| [@] en | |||
| [@2] en | |||
| [@5] en | |||
| [@] en_us | |||
| [@2] en_us | |||
| [@5] en_us | |||
| [3] en_rp | |||
| [@] en_rp | |||
| [V] cy | |||
| @@ -1081,9 +1076,7 @@ vowel/0_3 [O:] en_us | |||
| [A] hu | |||
| vowel/@_2 [@] fr | |||
| [W] fr | |||
| vowel/&_2 [a] en_us | |||
| [aa] en_us | |||
| [&?] zhh | |||
| vowel/&_2 [&?] zhh | |||
| vowel/@_3 [@] en_sc | |||
| [I] en_sc | |||
| [@2] en_sc | |||
| @@ -1234,7 +1227,6 @@ vowel/ee_1 [E] base2 | |||
| [E:] no | |||
| [e] zhy | |||
| vowel/ee_2 [E] en | |||
| [E] en_us | |||
| [E] cy | |||
| [E2] nl | |||
| [E] zh | |||
| @@ -1271,7 +1263,10 @@ vowel/e_mid2 [E] af | |||
| vowel/@_fnt [@2] hr | |||
| [@] en_wi | |||
| [@2] en_wi | |||
| vowel/@_hgh [@] no | |||
| vowel/@_hgh [@] en_us | |||
| [@2] en_us | |||
| [@5] en_us | |||
| [@] no | |||
| vowel/i [i] base2 | |||
| [i:] en_n | |||
| [i] en_wm | |||
| @@ -1292,7 +1287,8 @@ vowel/i [i] base2 | |||
| [i?] zhh | |||
| [i] sw | |||
| [i] en_wi | |||
| vowel/i# [i] en_rp | |||
| vowel/i# [i] en_us | |||
| [i] en_rp | |||
| [y:] cy | |||
| vowel/i_2 [i:] en_rp | |||
| [i2] de | |||
| @@ -1464,12 +1460,12 @@ vowel/u_2 [u1] fi | |||
| [U] hr | |||
| [u] ro | |||
| vowel/u#_2 [u-] sv | |||
| vowel/u_3 [u:] en_us | |||
| [yU] ro | |||
| vowel/u_3 [yU] ro | |||
| vowel/u_4 [u:] en_n | |||
| vowel/u#_4 [U] en_sc | |||
| [u:] en_sc | |||
| vowel/u_5 [u] sw | |||
| vowel/u#_5 [u:] en_us | |||
| vowel/u_6 [U] pt_pt | |||
| [u] pt_pt | |||
| vowel/u_7 [u] vi | |||
| @@ -1509,9 +1505,9 @@ vowel/uu_bck [U] en_n | |||
| [U] no | |||
| [u] zhy | |||
| [U] en_wi | |||
| vowel/V [3] en_sc | |||
| vowel/V [V] en_us | |||
| [3] en_sc | |||
| vowel/V_2 [V] en | |||
| [V] en_us | |||
| [a] af | |||
| [V] ru | |||
| [V#] ru | |||
| @@ -1594,15 +1590,17 @@ vwl_en_rp/oo [U@] en_rp | |||
| vwl_en/u [u:] en | |||
| vwl_en/u_L [u:] en | |||
| [u:] en_n | |||
| [u:] en_us | |||
| [u:] en_rp | |||
| vwl_en_us/3_us [3] en_us | |||
| [3:] en_us | |||
| vwl_en_us/a [a] en_us | |||
| [aa] en_us | |||
| vwl_en_us/aai [aI] en_us | |||
| vwl_en_us/ar [A:] en_us | |||
| [A@] en_us | |||
| vwl_en_us/ee [E] en_us | |||
| vwl_en_us/ei [eI] en_us | |||
| vwl_en_us/er [e@] en_us | |||
| vwl_en_us/i_final3 [i] en_us | |||
| vwl_en_us/ii [I] en_us | |||
| [I2] en_us | |||
| vwl_en_us/ir [i@] en_us | |||
| @@ -7,7 +7,7 @@ | |||
| phoneme @ // Schwa | |||
| vowel starttype (@) endtype (@) | |||
| formants vowel/@ | |||
| formants vowel/@_hgh | |||
| unstressed | |||
| linkout r- | |||
| length 130 | |||
| @@ -21,13 +21,13 @@ phoneme 3 // Schwa, used for rhotic schwa in American | |||
| unstressed | |||
| linkout r- | |||
| beforevowel @ | |||
| length 180 | |||
| length 200 | |||
| endphoneme | |||
| phoneme @2 // Schwa, changes to I before a vowel | |||
| vowel starttype (@) endtype (@) | |||
| formants vowel/@ | |||
| formants vowel/@_hgh | |||
| unstressed | |||
| beforevowel I2 | |||
| length 120 | |||
| @@ -35,7 +35,7 @@ endphoneme | |||
| phoneme @5 // Schwa, changes to U before a vowel | |||
| vowel starttype (@) endtype (@) | |||
| formants vowel/@ | |||
| formants vowel/@_hgh | |||
| unstressed | |||
| beforevowelpause U | |||
| length 130 | |||
| @@ -53,18 +53,18 @@ endphoneme | |||
| phoneme a | |||
| vowel starttype (a) endtype (@) | |||
| length 180 | |||
| formants vowel/&_2 | |||
| // formants vwl_en_us/a | |||
| length 200 | |||
| // formants vowel/&_2 | |||
| formants vwl_en_us/a | |||
| reduceto a2 0 | |||
| endphoneme | |||
| phoneme aa // 'bath' etc. | |||
| vowel starttype (a) endtype (@) | |||
| length 190 | |||
| formants vowel/&_2 | |||
| // formants vwl_en_us/a | |||
| length 220 | |||
| // formants vowel/&_2 | |||
| formants vwl_en_us/a | |||
| linkout r- | |||
| endphoneme | |||
| @@ -72,7 +72,7 @@ endphoneme | |||
| phoneme a2 | |||
| vowel starttype (@) endtype (@) | |||
| unstressed | |||
| length 140 | |||
| length 150 | |||
| formants vowel/a#_3 | |||
| linkout r- | |||
| endphoneme | |||
| @@ -80,15 +80,16 @@ endphoneme | |||
| phoneme E | |||
| vowel starttype (e) endtype (e) | |||
| length 160 | |||
| formants vowel/ee_2 | |||
| length 185 | |||
| // formants vowel/ee_2 | |||
| formants vwl_en_us/ee | |||
| reduceto I 0 | |||
| endphoneme | |||
| phoneme I | |||
| vowel starttype (i) endtype (i) | |||
| length 130 | |||
| length 120 | |||
| formants vwl_en_us/ii | |||
| linkout ; | |||
| endphoneme | |||
| @@ -105,15 +106,16 @@ endphoneme | |||
| phoneme i // optional variant of [I] for end of words | |||
| vowel starttype (i) endtype (i) | |||
| length 170 | |||
| formants vwl_en_us/i_final3 | |||
| length 200 | |||
| // formants vwl_en_us/i_final3 | |||
| formants vowel/i# | |||
| linkout ; | |||
| endphoneme | |||
| phoneme 0 | |||
| vowel starttype (o) endtype (o) | |||
| length 180 | |||
| length 200 | |||
| formants vowel/aa_8 | |||
| reduceto @ 0 | |||
| endphoneme | |||
| @@ -121,9 +123,9 @@ endphoneme | |||
| phoneme V | |||
| vowel starttype (a) endtype (@) | |||
| length 170 | |||
| // formants vwl_en_us/V | |||
| formants vowel/V_2 | |||
| length 165 | |||
| // formants vowel/V_2 | |||
| formants vowel/V | |||
| reduceto @ 0 | |||
| endphoneme | |||
| @@ -154,7 +156,7 @@ endphoneme | |||
| phoneme 3: | |||
| vowel starttype (@) endtype (@) | |||
| length 220 | |||
| length 190 | |||
| // formants vwl_en_us/@r_us2 | |||
| formants vwl_en_us/3_us | |||
| // reduceto @ 0 | |||
| @@ -164,7 +166,7 @@ endphoneme | |||
| phoneme i: | |||
| vowel starttype (i) endtype (i) | |||
| length 160 | |||
| length 150 | |||
| formants vowel/i_en | |||
| after w w/wi2 | |||
| linkout ; | |||
| @@ -182,7 +184,7 @@ endphoneme | |||
| phoneme O@ | |||
| vowel starttype (o) endtype (@) | |||
| length 240 | |||
| length 270 | |||
| formants vwl_en_us/oor | |||
| appendph r | |||
| endphoneme | |||
| @@ -190,7 +192,7 @@ endphoneme | |||
| phoneme o@ | |||
| vowel starttype (o) endtype (@) | |||
| length 240 | |||
| length 270 | |||
| formants vwl_en_us/or | |||
| appendph r | |||
| endphoneme | |||
| @@ -198,7 +200,7 @@ endphoneme | |||
| phoneme O | |||
| vowel starttype (o) endtype (o) | |||
| length 150 | |||
| length 200 | |||
| formants vwl_en_us/oo | |||
| reduceto @ 0 | |||
| endphoneme | |||
| @@ -206,50 +208,51 @@ endphoneme | |||
| phoneme u: | |||
| vowel starttype (u) endtype (u) | |||
| length 170 | |||
| formants vowel/u_3 | |||
| before l/2 vwl_en/u_L-40+l/L2_uL | |||
| length 160 | |||
| formants vowel/u#_5 | |||
| // before l/2 vwl_en/u_L-40+l/L2_uL | |||
| endphoneme | |||
| phoneme aU | |||
| vowel starttype (a) endtype (u) | |||
| length 200 | |||
| length 210 | |||
| formants vdiph/au_2 | |||
| endphoneme | |||
| phoneme oU | |||
| vowel starttype (@) endtype (u) | |||
| length 210 | |||
| length 240 | |||
| formants vdiph/8u | |||
| endphoneme | |||
| phoneme aI | |||
| vowel starttype (a) endtype (i) | |||
| length 210 | |||
| length 235 | |||
| formants vwl_en_us/aai | |||
| endphoneme | |||
| phoneme eI | |||
| vowel starttype (e) endtype (i) | |||
| length 210 | |||
| formants vdiph/eei_2 | |||
| length 235 | |||
| // formants vdiph/eei_2 | |||
| formants vwl_en_us/ei | |||
| endphoneme | |||
| phoneme OI | |||
| vowel starttype (o) endtype (i) | |||
| length 220 | |||
| formants vdiph/ooi | |||
| length 300 | |||
| formants vdiph/ooi_3 | |||
| endphoneme | |||
| phoneme e@ | |||
| vowel starttype (e) endtype (@) | |||
| length 250 | |||
| length 280 | |||
| formants vwl_en_us/er | |||
| appendph r | |||
| endphoneme | |||
| @@ -257,7 +260,7 @@ endphoneme | |||
| phoneme i@ | |||
| vowel starttype (i) endtype (@) | |||
| length 220 | |||
| length 230 | |||
| formants vwl_en_us/ir | |||
| appendph r | |||
| endphoneme | |||
| @@ -265,7 +268,7 @@ endphoneme | |||
| phoneme U@ | |||
| vowel starttype (@) endtype (@) | |||
| length 220 | |||
| length 230 | |||
| formants vwl_en_us/ur | |||
| linkout r- | |||
| endphoneme | |||
| @@ -304,7 +307,7 @@ phoneme t# // reduced [t] as in "city" | |||
| vowelin f1=0 f2=1700 -300 300 f3=-100 80 | |||
| vowelout f1=0 f2=1700 -300 300 f3=-100 80 | |||
| lengthmod 5 | |||
| wave x/d%80 | |||
| wave x/d%70 | |||
| endphoneme | |||
| @@ -12,8 +12,8 @@ static const char* FILENAME="/tmp/espeak.log"; | |||
| void debug_init() | |||
| { | |||
| fd_log = fopen(FILENAME,"a"); | |||
| setvbuf(fd_log, NULL, _IONBF, 0); | |||
| if((fd_log = fopen(FILENAME,"a")) != NULL) | |||
| setvbuf(fd_log, NULL, _IONBF, 0); | |||
| } | |||
| void debug_enter(const char* text) | |||
| @@ -490,7 +490,7 @@ void Translator::GetTranslatedPhonemeString(char *phon_out, int n_phon_out) | |||
| int stress; | |||
| PHONEME_LIST *plist; | |||
| static const char *stress_chars = "==,,'*"; | |||
| static const char *stress_chars = "==,,''"; | |||
| if(phon_out != NULL) | |||
| { | |||
| @@ -2199,6 +2199,7 @@ int Translator::TranslateRules(char *p_start, char *phonemes, int ph_size, char | |||
| int g1; /* first group for this letter */ | |||
| int n; | |||
| int letter; | |||
| int any_alpha=0; | |||
| int ix; | |||
| int digit_count=0; | |||
| char *p; | |||
| @@ -2245,11 +2246,13 @@ int Translator::TranslateRules(char *p_start, char *phonemes, int ph_size, char | |||
| while(((c = *p) != ' ') && (c != 0)) | |||
| { | |||
| if(IsAlpha(wc)) | |||
| any_alpha = wc; | |||
| wc_prev = wc; | |||
| wc_bytes = utf8_in(&wc,p,0); | |||
| n = groups2_count[c]; | |||
| if(IsDigit(wc) && ((langopts.tone_numbers == 0) || !IsAlpha(wc_prev))) | |||
| if(IsDigit(wc) && ((langopts.tone_numbers == 0) || !any_alpha)) | |||
| { | |||
| // lookup the number in *_list not *_rules | |||
| char string[8]; | |||
| @@ -814,6 +814,8 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
| int final_stressed=0; | |||
| int tone_ph; | |||
| int pause; | |||
| int tone_promoted; | |||
| PHONEME_TAB *tph; | |||
| PHONEME_TAB *prev_tph; // forget across word boundary | |||
| PHONEME_TAB *prevw_tph; // remember across word boundary | |||
| @@ -849,13 +851,21 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
| } | |||
| pause = 1; | |||
| tone_promoted = 0; | |||
| prev_p = p = &phoneme_list[0]; | |||
| prev_tph = prevw_tph = phoneme_tab[phonPAUSE]; | |||
| // perform tone sandhi | |||
| for(ix=0; ix<n_phoneme_list; ix++, p++) | |||
| { | |||
| if((p->newword) && ((option_tone1 & 1)==0)) | |||
| if((p->type == phPAUSE) && (p->ph->std_length > 50)) | |||
| { | |||
| pause = 1; // there is a pause since the previous vowel | |||
| } | |||
| if(p->newword) | |||
| { | |||
| prev_tph = phoneme_tab[phonPAUSE]; // forget across word boundaries | |||
| } | |||
| @@ -863,14 +873,32 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
| if(p->type == phVOWEL) | |||
| { | |||
| tone_ph = p->tone_ph; | |||
| if(tone_ph == 0) | |||
| p->tone_ph = tone_ph = LookupPh("11"); // default tone 5 | |||
| tph = phoneme_tab[tone_ph]; | |||
| // Mandarin | |||
| if(translator_name == L('z','h')) | |||
| { | |||
| if(tone_ph == 0) | |||
| { | |||
| if(pause || tone_promoted) | |||
| { | |||
| tone_ph = LookupPh("55"); // no previous vowel, use tone 1 | |||
| tone_promoted = 1; | |||
| } | |||
| else | |||
| { | |||
| tone_ph = LookupPh("11"); // default tone 5 | |||
| } | |||
| p->tone_ph = tone_ph; | |||
| tph = phoneme_tab[tone_ph]; | |||
| } | |||
| else | |||
| { | |||
| tone_promoted = 0; | |||
| } | |||
| if(prev_tph->mnemonic == 0x343132) // [214] | |||
| { | |||
| if(tph->mnemonic == 0x343132) // [214] | |||
| @@ -901,6 +929,7 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
| prev_p = p; | |||
| prev2_tph = prevw_tph; | |||
| prevw_tph = prev_tph = tph; | |||
| pause = 0; | |||
| } | |||
| } | |||