Browse Source

git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@96 d46cf337-b52f-0410-862d-fd96e6ae7743

master
jonsd 17 years ago
parent
commit
74e4e9b09e
7 changed files with 44 additions and 34 deletions
  1. 7
    0
      src/dictionary.cpp
  2. 2
    2
      src/espeak.cpp
  3. 10
    16
      src/intonation.cpp
  4. 2
    2
      src/speak.cpp
  5. 1
    1
      src/synthdata.cpp
  6. 1
    1
      src/tr_languages.cpp
  7. 21
    12
      src/translate.cpp

+ 7
- 0
src/dictionary.cpp View File

@@ -1829,6 +1829,13 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
match.points += (21-distance_right);
post_ptr += letter_xbytes;
}
else
if(langopts.tone_numbers)
{
// also match if there is no digit
match.points += (21-distance_right);
post_ptr--;
}
else
failed = 1;
break;

+ 2
- 2
src/espeak.cpp View File

@@ -105,12 +105,12 @@ void strncpy0(char *dest, const char *source, int size)
void DisplayVoices(FILE *f_out, char *language)
{//============================================
int ix;
char *p;
const char *p;
int len;
int count;
int scores = 0;
const espeak_VOICE *v;
char *lang_name;
const char *lang_name;
char age_buf[12];
const espeak_VOICE **voices;
espeak_VOICE voice_select;

+ 10
- 16
src/intonation.cpp View File

@@ -820,9 +820,9 @@ void Translator::CalcPitches_Tone(int clause_tone)
PHONEME_TAB *prev2_tph; // 2 tones previous
PHONEME_LIST *prev_p;

int pitch_adjust = 13; // pitch gradient through the clause - inital value
int pitch_decrement = 3; // decrease by this for each stressed syllable
int pitch_low = 0; // until it drops to this
int pitch_adjust = 10; // pitch gradient through the clause - inital value
int pitch_decrement = 0; // decrease by this for each stressed syllable
int pitch_low = 10; // until it drops to this
int pitch_high = 10; // then reset to this

p = &phoneme_list[0];
@@ -912,7 +912,7 @@ void Translator::CalcPitches_Tone(int clause_tone)
{
tone_ph = p->tone_ph;

if(p->tone >= 0) // TEST, consider all syllables as stressed
if(p->tone != 1) // TEST, consider all syllables as stressed
{
if(ix == final_stressed)
{
@@ -925,21 +925,15 @@ void Translator::CalcPitches_Tone(int clause_tone)
if(pitch_adjust <= pitch_low)
pitch_adjust = pitch_high;
}

if(tone_ph ==0)
{
tone_ph = phonDEFAULTTONE; // no tone specified, use default tone 1
p->tone_ph = tone_ph;
}
p->pitch1 = pitch_adjust + phoneme_tab[tone_ph]->start_type;
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type;
}
else

if(tone_ph ==0)
{
// what to do for unstressed syllables ?
p->pitch1 = 10; // temporary
p->pitch2 = 14;
tone_ph = phonDEFAULTTONE; // no tone specified, use default tone 1
p->tone_ph = tone_ph;
}
p->pitch1 = pitch_adjust + phoneme_tab[tone_ph]->start_type;
p->pitch2 = pitch_adjust + phoneme_tab[tone_ph]->end_type;
}
}


+ 2
- 2
src/speak.cpp View File

@@ -135,12 +135,12 @@ void Free(void *ptr)
void DisplayVoices(FILE *f_out, char *language)
{//============================================
int ix;
char *p;
const char *p;
int len;
int count;
int scores = 0;
const espeak_VOICE *v;
char *lang_name;
const char *lang_name;
char age_buf[12];
const espeak_VOICE **voices;
espeak_VOICE voice_select;

+ 1
- 1
src/synthdata.cpp View File

@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"

const char *version_string = "1.29.15 01.Nov.07";
const char *version_string = "1.29.16 01.Nov.07";
const int version_phdata = 0x012901;

int option_device_number = -1;

+ 1
- 1
src/tr_languages.cpp View File

@@ -649,7 +649,7 @@ SetLengthMods(tr,3); // all equal
case L('z','h'):
{
static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250};
static int stress_amps_qaa[] = {22,18, 22,22, 22,22, 22,22 };
static int stress_amps_qaa[] = {22,16, 22,22, 22,22, 22,22 };
tr = new Translator();
SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa);


+ 21
- 12
src/translate.cpp View File

@@ -1664,6 +1664,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
int next_word_flags;
int embedded_count = 0;
int letter_count = 0;
int space_inserted = 0;
char *word;
char *p;
int j, k;
@@ -1786,9 +1787,6 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
utf8_in(&prev_in,&source[source_index-1],1); // prev_in = source[source_index-1];
}

if(prev_source_index == source_index)
char_inserted = 0; // have done an unget, so discard any character to be inserted

prev_source_index = source_index;

if(char_inserted)
@@ -1846,7 +1844,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
{
// break after the specified number of digits
c = ' ';
source_index = prev_source_index; // unget
space_inserted = 1;
count_sayas_digits = 0;
}
}
@@ -1856,13 +1854,16 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
if(iswdigit(prev_out))
{
c = ' ';
source_index = prev_source_index; // unget
space_inserted = 1;
}
}
}
else
if((option_sayas2 & 0xf0) != 0x10)
{
// speak as words

#ifdef deleted
if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out))
{
// TESTING, explicit indication of stressed syllable by /2 after the word
@@ -1870,6 +1871,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
source_index++;
c = ' ';
}
#endif
if((c == 0x92) || (c == 0xb4) || (c == 0x2019))
c = '\''; // 'microsoft' quote or sexed closing single quote - possibly used as apostrophe

@@ -1897,7 +1899,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
else
{
c = ' '; // ensure we have an end-of-word terminator
source_index = prev_source_index;
space_inserted = 1;
}
}
}
@@ -1906,7 +1908,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
if(!iswdigit(c) && (c != '.') && (c != ','))
{
c = ' '; // terminate digit string with a space
source_index = prev_source_index;
space_inserted = 1;
}
}

@@ -1934,7 +1936,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
{
// start of word, insert space if not one there already
c = ' ';
source_index = prev_source_index; // unget
space_inserted = 1;
}
else
{
@@ -1960,8 +1962,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
if(iswlower(prev_in))
{
c = ' '; // lower case followed by upper case, treat as new word
space_inserted = 1;
prev_in2 = c;
source_index = prev_source_index; // unget
}
//#ifdef deleted
// changed to break after the last uppercase letter, not before. See below
@@ -1970,8 +1972,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
(memcmp(&source[source_index],"s ",2) != 0)) // ENGLISH specific plural
{
c = ' '; // change from upper to lower case, start new word at the last uppercase
space_inserted = 1;
prev_in2 = c;
source_index = prev_source_index; // unget
next_word_flags |= FLAG_NOSPACE;
}
//#endif
@@ -1984,8 +1986,8 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
{
// change to break after the last uppercase letter, not before.
c = ' '; // more than one upper case followed by lower case, treat as new word
space_inserted = 1;
prev_in2 = c;
source_index = prev_source_index; // unget
}
#endif
if((all_upper_case) && (letter_count > 2))
@@ -2096,7 +2098,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
if((prev_out != ' ') && !iswdigit(prev_out) && (prev_out != langopts.decimal_sep)) // TEST2
{
c = ' ';
source_index = prev_source_index;
space_inserted = 1;
}
else
if((prev_out == ' ') && IsAlpha(sbuf[ix-2]) && !IsAlpha(prev_in))
@@ -2110,6 +2112,13 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)

if(iswspace(c))
{
if(space_inserted)
{
source_index = prev_source_index; // rewind to the previous character
char_inserted = 0;
space_inserted = 0;
}

if(prev_out == ' ')
{
continue; // multiple spaces

Loading…
Cancel
Save