espeakEVENT_PHONEME, fix audio position of vowel when it follows a voiced consonant. Ensure enough space in the event list when espeak_Initialize() is called with a small buffer size. Tone languages: set the final stressed syllable to stress=7 so that it can be longer. lang=zh: adjust vowels git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@136 d46cf337-b52f-0410-862d-fd96e6ae7743master
@@ -59,7 +59,11 @@ language). | |||
a4o Au51 | |||
a (DnK a | |||
a (DngK A | |||
ch) a (DngK A | |||
ch) a (4ngK a | |||
ch) a (ng4K a | |||
k) a (DngK A | |||
_) a (DngK A | |||
y) a iA | |||
y) ao Au | |||
@@ -144,7 +148,6 @@ language). | |||
.group o | |||
o o | |||
o (DngK u | |||
ou ou | |||
o1u ou55 | |||
o2u ou35 |
@@ -426,9 +426,9 @@ nn/_nn [N] base | |||
[N] zh | |||
nn/nn_ [N] base | |||
[N] en | |||
[N] zh | |||
nn/nn@ [(@)] base | |||
nn/nn#_ [N#] is | |||
nn/nn2_ [N] zh | |||
nn/nna [(a)] base | |||
nn/nne [(e)] base | |||
nn/nni [(i)] base | |||
@@ -838,7 +838,6 @@ vdiph2/ie [i@] en_wi | |||
[ie] fi | |||
[ia] th | |||
[i:a] th | |||
vdiph2/ie_2 [iE] zh | |||
vdiph2/ii@ [i@] en | |||
[i@3] en | |||
vdiph2/ii@_3 [i@] vi | |||
@@ -1438,6 +1437,7 @@ vowel/i_6 [i:] en_us | |||
[i] hr | |||
[i] id | |||
[i] tr | |||
vowel/i#_6 [i.] zh | |||
vowel/i#_7 [i[] zh | |||
vowel/i_en [i:] en | |||
[i:] fr | |||
@@ -1521,7 +1521,6 @@ vowel/o_4 [oU] en_n | |||
vowel/o-_4 [o] ro | |||
vowel/o_5 [O] nl | |||
vowel/o_6 [O:] nl | |||
vowel/o_7 [u] zh | |||
vowel/oe [W] en | |||
[W] af | |||
[W] de | |||
@@ -1530,6 +1529,7 @@ vowel/oe_2 [W] no | |||
vowel/oe_4 [W] sv | |||
vowel/o_mid [O] fr | |||
[o] hu | |||
[o] zh | |||
[o] tr | |||
vowel/oo [O:] en_sc | |||
[O] en_wi | |||
@@ -1810,13 +1810,14 @@ vwl_ru/u#u [u"] ru | |||
vwl_sv/r_sv3 [r] sv | |||
vwl_zh/aang [aan] zhy | |||
vwl_zh/aau [Au] zh | |||
vwl_zh/a_n [a] zh | |||
vwl_zh/ang [ang] zhy | |||
vwl_zh/eng [eng] zhy | |||
vwl_zh/iaa [iA] zh | |||
vwl_zh/iaau [iAu] zh | |||
vwl_zh/ie [iE] zh | |||
vwl_zh/ing [ing] zhy | |||
vwl_zh/iou [iou] zh | |||
vwl_zh/i_rfx [i.] zh | |||
vwl_zh/ng [ng] zhy | |||
vwl_zh/oeng [oen] zhy | |||
vwl_zh/ong [ong] zhy |
@@ -212,11 +212,11 @@ endphoneme | |||
phoneme N //should be more different from n | |||
vcd vel nasal | |||
vowelout f1=3 f2=2300 300 400 f3=-200 80 len=40 rms=20 brk | |||
vowelout f1=2 f2=1900 200 400 f3=400 80 len=50 rms=15 brk | |||
formants NULL | |||
before _ nn/nn_ | |||
before _ nn/nn2_ | |||
after _ nn/_nn | |||
lengthmod 1 | |||
lengthmod 7 | |||
after (i) nn/inn | |||
endphoneme | |||
@@ -224,6 +224,7 @@ phoneme a | |||
vowel starttype (a) endtype (a) | |||
length 250 | |||
formants vowel/a | |||
before N vwl_zh/a_n | |||
endphoneme | |||
phoneme A | |||
@@ -287,7 +288,8 @@ endphoneme | |||
phoneme i. //after ts. ts.h s. z. | |||
vowel starttype (i) endtype (i) | |||
length 250 | |||
formants vwl_zh/i_rfx | |||
// formants vwl_zh/i_rfx | |||
formants vowel/i#_6 | |||
endphoneme | |||
phoneme iA //try more before N | |||
@@ -305,7 +307,7 @@ endphoneme | |||
phoneme iE | |||
vowel starttype (i) endtype (e) | |||
length 250 | |||
formants vdiph2/ie_2 | |||
formants vwl_zh/ie | |||
endphoneme | |||
phoneme io | |||
@@ -324,6 +326,7 @@ phoneme o | |||
vowel starttype (o) endtype (o) | |||
length 250 | |||
formants vdiph2/o_oo | |||
before N vowel/o_mid | |||
endphoneme | |||
phoneme o- | |||
@@ -342,7 +345,6 @@ phoneme u //try more before N | |||
vowel starttype (u) endtype (u) | |||
length 250 | |||
formants vowel/u_bck | |||
before N vowel/o_7 | |||
endphoneme | |||
phoneme uA |
@@ -1880,14 +1880,14 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec | |||
case RULE_DIGIT: | |||
if(IsDigit(letter_w)) | |||
{ | |||
match.points += (21-distance_right); | |||
match.points += (20-distance_right); | |||
post_ptr += letter_xbytes; | |||
} | |||
else | |||
if(langopts.tone_numbers) | |||
{ | |||
// also match if there is no digit | |||
match.points += (21-distance_right); | |||
match.points += (20-distance_right); | |||
post_ptr--; | |||
} | |||
else |
@@ -759,8 +759,14 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
{ | |||
if((p->type == phVOWEL) && (p->tone >= 4)) | |||
{ | |||
final_stressed = ix; | |||
count_stressed++; | |||
if(count_stressed == 0) | |||
final_stressed = ix; | |||
if(p->tone >= 4) | |||
{ | |||
final_stressed = ix; | |||
count_stressed++; | |||
} | |||
} | |||
} | |||
@@ -769,7 +775,6 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
{ | |||
// LANG=vi | |||
p = &phoneme_list[final_stressed]; | |||
p->tone = 7; | |||
if(p->tone_ph == 0) | |||
p->tone_ph = LookupPh("7"); // change tone 1 to falling tone at end of clause | |||
} | |||
@@ -889,6 +894,9 @@ void Translator::CalcPitches_Tone(int clause_tone) | |||
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type; | |||
} | |||
} | |||
phoneme_list[final_stressed].tone = 7; | |||
} // end of Translator::CalcPitches_Tone | |||
@@ -698,8 +698,9 @@ ENTER("espeak_Initialize"); | |||
if((out_start = outbuf) == NULL) | |||
return(EE_INTERNAL_ERROR); | |||
// allocate space for event list. Allow 200 events per second | |||
n_event_list = (buf_length*200)/1000; | |||
// allocate space for event list. Allow 200 events per second. | |||
// Add a constant to allow for very small buf_length | |||
n_event_list = (buf_length*200)/1000 + 20; | |||
if((event_list = (espeak_EVENT *)realloc(event_list,sizeof(espeak_EVENT) * n_event_list)) == NULL) | |||
return(EE_INTERNAL_ERROR); | |||
@@ -35,7 +35,7 @@ | |||
#include "translate.h" | |||
#include "wave.h" | |||
const char *version_string = "1.31.05 04.Feb.08"; | |||
const char *version_string = "1.31.06 05.Feb.08"; | |||
const int version_phdata = 0x013105; | |||
int option_device_number = -1; |
@@ -1097,6 +1097,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) | |||
unsigned char *amp_env; | |||
PHONEME_TAB *ph; | |||
PHONEME_TAB *prev_ph; | |||
static int sourceix=0; | |||
#ifdef TEST_MBROLA | |||
if(mbrola_name[0] != 0) | |||
@@ -1140,15 +1141,16 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) | |||
if(p->newword) | |||
{ | |||
last_frame = NULL; | |||
sourceix = (p->sourceix & 0x7ff) + clause_start_char; | |||
if(p->newword & 4) | |||
DoMarker(espeakEVENT_SENTENCE, (p->sourceix & 0x7ff) + clause_start_char, 0, count_sentences); // start of sentence | |||
DoMarker(espeakEVENT_SENTENCE, sourceix, 0, count_sentences); // start of sentence | |||
// if(p->newword & 2) | |||
// DoMarker(espeakEVENT_END, count_characters, 0, count_sentences); // end of clause | |||
if(p->newword & 1) | |||
DoMarker(espeakEVENT_WORD, (p->sourceix & 0x7ff) + clause_start_char, p->sourceix >> 11, clause_start_word + word_count++); | |||
DoMarker(espeakEVENT_WORD, sourceix, p->sourceix >> 11, clause_start_word + word_count++); | |||
} | |||
EndAmplitude(); | |||
@@ -1156,9 +1158,10 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) | |||
if(p->prepause > 0) | |||
DoPause(p->prepause); | |||
if(option_phoneme_events) | |||
if(option_phoneme_events && (p->type != phVOWEL)) | |||
{ | |||
DoMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, p->ph->mnemonic); | |||
// Note, for vowels, do the phoneme event after the vowel-start | |||
DoMarker(espeakEVENT_PHONEME, sourceix, 0, p->ph->mnemonic); | |||
} | |||
switch(p->type) | |||
@@ -1398,6 +1401,11 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume) | |||
DoSpect(ph,prev->ph,next->ph,1,p,modulation); | |||
} | |||
if(option_phoneme_events) | |||
{ | |||
DoMarker(espeakEVENT_PHONEME, sourceix, 0, p->ph->mnemonic); | |||
} | |||
DoSpect(p->ph,prev->ph,next->ph,2,p,modulation); | |||
memset(vowel_transition,0,sizeof(vowel_transition)); |
@@ -718,7 +718,7 @@ SetLengthMods(tr,3); // all equal | |||
case L('z','h'): | |||
case L_zhy: | |||
{ | |||
static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 230,250}; | |||
static const short stress_lengths_zh[8] = {230,150, 230,230, 230,0, 230,300}; | |||
static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | |||
tr = new Translator; |