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
| a4o Au51 | a4o Au51 | ||||
| a (DnK a | 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) a iA | ||||
| y) ao Au | y) ao Au | ||||
| .group o | .group o | ||||
| o o | o o | ||||
| o (DngK u | |||||
| ou ou | ou ou | ||||
| o1u ou55 | o1u ou55 | ||||
| o2u ou35 | o2u ou35 |
| [N] zh | [N] zh | ||||
| nn/nn_ [N] base | nn/nn_ [N] base | ||||
| [N] en | [N] en | ||||
| [N] zh | |||||
| nn/nn@ [(@)] base | nn/nn@ [(@)] base | ||||
| nn/nn#_ [N#] is | nn/nn#_ [N#] is | ||||
| nn/nn2_ [N] zh | |||||
| nn/nna [(a)] base | nn/nna [(a)] base | ||||
| nn/nne [(e)] base | nn/nne [(e)] base | ||||
| nn/nni [(i)] base | nn/nni [(i)] base | ||||
| [ie] fi | [ie] fi | ||||
| [ia] th | [ia] th | ||||
| [i:a] th | [i:a] th | ||||
| vdiph2/ie_2 [iE] zh | |||||
| vdiph2/ii@ [i@] en | vdiph2/ii@ [i@] en | ||||
| [i@3] en | [i@3] en | ||||
| vdiph2/ii@_3 [i@] vi | vdiph2/ii@_3 [i@] vi | ||||
| [i] hr | [i] hr | ||||
| [i] id | [i] id | ||||
| [i] tr | [i] tr | ||||
| vowel/i#_6 [i.] zh | |||||
| vowel/i#_7 [i[] zh | vowel/i#_7 [i[] zh | ||||
| vowel/i_en [i:] en | vowel/i_en [i:] en | ||||
| [i:] fr | [i:] fr | ||||
| vowel/o-_4 [o] ro | vowel/o-_4 [o] ro | ||||
| vowel/o_5 [O] nl | vowel/o_5 [O] nl | ||||
| vowel/o_6 [O:] nl | vowel/o_6 [O:] nl | ||||
| vowel/o_7 [u] zh | |||||
| vowel/oe [W] en | vowel/oe [W] en | ||||
| [W] af | [W] af | ||||
| [W] de | [W] de | ||||
| vowel/oe_4 [W] sv | vowel/oe_4 [W] sv | ||||
| vowel/o_mid [O] fr | vowel/o_mid [O] fr | ||||
| [o] hu | [o] hu | ||||
| [o] zh | |||||
| [o] tr | [o] tr | ||||
| vowel/oo [O:] en_sc | vowel/oo [O:] en_sc | ||||
| [O] en_wi | [O] en_wi | ||||
| vwl_sv/r_sv3 [r] sv | vwl_sv/r_sv3 [r] sv | ||||
| vwl_zh/aang [aan] zhy | vwl_zh/aang [aan] zhy | ||||
| vwl_zh/aau [Au] zh | vwl_zh/aau [Au] zh | ||||
| vwl_zh/a_n [a] zh | |||||
| vwl_zh/ang [ang] zhy | vwl_zh/ang [ang] zhy | ||||
| vwl_zh/eng [eng] zhy | vwl_zh/eng [eng] zhy | ||||
| vwl_zh/iaa [iA] zh | vwl_zh/iaa [iA] zh | ||||
| vwl_zh/iaau [iAu] zh | vwl_zh/iaau [iAu] zh | ||||
| vwl_zh/ie [iE] zh | |||||
| vwl_zh/ing [ing] zhy | vwl_zh/ing [ing] zhy | ||||
| vwl_zh/iou [iou] zh | vwl_zh/iou [iou] zh | ||||
| vwl_zh/i_rfx [i.] zh | |||||
| vwl_zh/ng [ng] zhy | vwl_zh/ng [ng] zhy | ||||
| vwl_zh/oeng [oen] zhy | vwl_zh/oeng [oen] zhy | ||||
| vwl_zh/ong [ong] zhy | vwl_zh/ong [ong] zhy |
| phoneme N //should be more different from n | phoneme N //should be more different from n | ||||
| vcd vel nasal | 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 | formants NULL | ||||
| before _ nn/nn_ | |||||
| before _ nn/nn2_ | |||||
| after _ nn/_nn | after _ nn/_nn | ||||
| lengthmod 1 | |||||
| lengthmod 7 | |||||
| after (i) nn/inn | after (i) nn/inn | ||||
| endphoneme | endphoneme | ||||
| vowel starttype (a) endtype (a) | vowel starttype (a) endtype (a) | ||||
| length 250 | length 250 | ||||
| formants vowel/a | formants vowel/a | ||||
| before N vwl_zh/a_n | |||||
| endphoneme | endphoneme | ||||
| phoneme A | phoneme A | ||||
| phoneme i. //after ts. ts.h s. z. | phoneme i. //after ts. ts.h s. z. | ||||
| vowel starttype (i) endtype (i) | vowel starttype (i) endtype (i) | ||||
| length 250 | length 250 | ||||
| formants vwl_zh/i_rfx | |||||
| // formants vwl_zh/i_rfx | |||||
| formants vowel/i#_6 | |||||
| endphoneme | endphoneme | ||||
| phoneme iA //try more before N | phoneme iA //try more before N | ||||
| phoneme iE | phoneme iE | ||||
| vowel starttype (i) endtype (e) | vowel starttype (i) endtype (e) | ||||
| length 250 | length 250 | ||||
| formants vdiph2/ie_2 | |||||
| formants vwl_zh/ie | |||||
| endphoneme | endphoneme | ||||
| phoneme io | phoneme io | ||||
| vowel starttype (o) endtype (o) | vowel starttype (o) endtype (o) | ||||
| length 250 | length 250 | ||||
| formants vdiph2/o_oo | formants vdiph2/o_oo | ||||
| before N vowel/o_mid | |||||
| endphoneme | endphoneme | ||||
| phoneme o- | phoneme o- | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 250 | length 250 | ||||
| formants vowel/u_bck | formants vowel/u_bck | ||||
| before N vowel/o_7 | |||||
| endphoneme | endphoneme | ||||
| phoneme uA | phoneme uA |
| case RULE_DIGIT: | case RULE_DIGIT: | ||||
| if(IsDigit(letter_w)) | if(IsDigit(letter_w)) | ||||
| { | { | ||||
| match.points += (21-distance_right); | |||||
| match.points += (20-distance_right); | |||||
| post_ptr += letter_xbytes; | post_ptr += letter_xbytes; | ||||
| } | } | ||||
| else | else | ||||
| if(langopts.tone_numbers) | if(langopts.tone_numbers) | ||||
| { | { | ||||
| // also match if there is no digit | // also match if there is no digit | ||||
| match.points += (21-distance_right); | |||||
| match.points += (20-distance_right); | |||||
| post_ptr--; | post_ptr--; | ||||
| } | } | ||||
| else | else |
| { | { | ||||
| if((p->type == phVOWEL) && (p->tone >= 4)) | 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++; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| { | { | ||||
| // LANG=vi | // LANG=vi | ||||
| p = &phoneme_list[final_stressed]; | p = &phoneme_list[final_stressed]; | ||||
| p->tone = 7; | |||||
| if(p->tone_ph == 0) | if(p->tone_ph == 0) | ||||
| p->tone_ph = LookupPh("7"); // change tone 1 to falling tone at end of clause | p->tone_ph = LookupPh("7"); // change tone 1 to falling tone at end of clause | ||||
| } | } | ||||
| p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type; | p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type; | ||||
| } | } | ||||
| } | } | ||||
| phoneme_list[final_stressed].tone = 7; | |||||
| } // end of Translator::CalcPitches_Tone | } // end of Translator::CalcPitches_Tone | ||||
| if((out_start = outbuf) == NULL) | if((out_start = outbuf) == NULL) | ||||
| return(EE_INTERNAL_ERROR); | 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) | if((event_list = (espeak_EVENT *)realloc(event_list,sizeof(espeak_EVENT) * n_event_list)) == NULL) | ||||
| return(EE_INTERNAL_ERROR); | return(EE_INTERNAL_ERROR); | ||||
| #include "translate.h" | #include "translate.h" | ||||
| #include "wave.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; | const int version_phdata = 0x013105; | ||||
| int option_device_number = -1; | int option_device_number = -1; |
| unsigned char *amp_env; | unsigned char *amp_env; | ||||
| PHONEME_TAB *ph; | PHONEME_TAB *ph; | ||||
| PHONEME_TAB *prev_ph; | PHONEME_TAB *prev_ph; | ||||
| static int sourceix=0; | |||||
| #ifdef TEST_MBROLA | #ifdef TEST_MBROLA | ||||
| if(mbrola_name[0] != 0) | if(mbrola_name[0] != 0) | ||||
| if(p->newword) | if(p->newword) | ||||
| { | { | ||||
| last_frame = NULL; | last_frame = NULL; | ||||
| sourceix = (p->sourceix & 0x7ff) + clause_start_char; | |||||
| if(p->newword & 4) | 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) | // if(p->newword & 2) | ||||
| // DoMarker(espeakEVENT_END, count_characters, 0, count_sentences); // end of clause | // DoMarker(espeakEVENT_END, count_characters, 0, count_sentences); // end of clause | ||||
| if(p->newword & 1) | 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(); | EndAmplitude(); | ||||
| if(p->prepause > 0) | if(p->prepause > 0) | ||||
| DoPause(p->prepause); | 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) | switch(p->type) | ||||
| DoSpect(ph,prev->ph,next->ph,1,p,modulation); | 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); | DoSpect(p->ph,prev->ph,next->ph,2,p,modulation); | ||||
| memset(vowel_transition,0,sizeof(vowel_transition)); | memset(vowel_transition,0,sizeof(vowel_transition)); |
| case L('z','h'): | case L('z','h'): | ||||
| case L_zhy: | 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 }; | static const unsigned char stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | ||||
| tr = new Translator; | tr = new Translator; |