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

match.points += (21-distance_right); match.points += (21-distance_right);
post_ptr += letter_xbytes; post_ptr += letter_xbytes;
} }
else
if(langopts.tone_numbers)
{
// also match if there is no digit
match.points += (21-distance_right);
post_ptr--;
}
else else
failed = 1; failed = 1;
break; break;

+ 2
- 2
src/espeak.cpp View File

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

+ 10
- 16
src/intonation.cpp View File

PHONEME_TAB *prev2_tph; // 2 tones previous PHONEME_TAB *prev2_tph; // 2 tones previous
PHONEME_LIST *prev_p; 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 int pitch_high = 10; // then reset to this


p = &phoneme_list[0]; p = &phoneme_list[0];
{ {
tone_ph = p->tone_ph; 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) if(ix == final_stressed)
{ {
if(pitch_adjust <= pitch_low) if(pitch_adjust <= pitch_low)
pitch_adjust = pitch_high; 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

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

+ 1
- 1
src/synthdata.cpp View File

#include "translate.h" #include "translate.h"
#include "wave.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; const int version_phdata = 0x012901;


int option_device_number = -1; int option_device_number = -1;

+ 1
- 1
src/tr_languages.cpp View File

case L('z','h'): case L('z','h'):
{ {
static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250}; 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(); tr = new Translator();
SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa); SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa);



+ 21
- 12
src/translate.cpp View File

int next_word_flags; int next_word_flags;
int embedded_count = 0; int embedded_count = 0;
int letter_count = 0; int letter_count = 0;
int space_inserted = 0;
char *word; char *word;
char *p; char *p;
int j, k; int j, k;
utf8_in(&prev_in,&source[source_index-1],1); // prev_in = source[source_index-1]; 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; prev_source_index = source_index;


if(char_inserted) if(char_inserted)
{ {
// break after the specified number of digits // break after the specified number of digits
c = ' '; c = ' ';
source_index = prev_source_index; // unget
space_inserted = 1;
count_sayas_digits = 0; count_sayas_digits = 0;
} }
} }
if(iswdigit(prev_out)) if(iswdigit(prev_out))
{ {
c = ' '; c = ' ';
source_index = prev_source_index; // unget
space_inserted = 1;
} }
} }
} }
else else
if((option_sayas2 & 0xf0) != 0x10) if((option_sayas2 & 0xf0) != 0x10)
{ {
// speak as words

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


else else
{ {
c = ' '; // ensure we have an end-of-word terminator c = ' '; // ensure we have an end-of-word terminator
source_index = prev_source_index;
space_inserted = 1;
} }
} }
} }
if(!iswdigit(c) && (c != '.') && (c != ',')) if(!iswdigit(c) && (c != '.') && (c != ','))
{ {
c = ' '; // terminate digit string with a space c = ' '; // terminate digit string with a space
source_index = prev_source_index;
space_inserted = 1;
} }
} }


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


if(iswspace(c)) 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 == ' ') if(prev_out == ' ')
{ {
continue; // multiple spaces continue; // multiple spaces

Loading…
Cancel
Save