Changes to voice: en-r

git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@97 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-11-06 09:33:54 +00:00
parent 74e4e9b09e
commit bd79fee87d
41 changed files with 110 additions and 68 deletions
+2 -2
View File
@@ -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)
+5 -2
View File
@@ -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];
+33 -4
View File
@@ -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;
}
}