mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-14 09:37:47 +00:00
Merge branch 'master' into development
This commit is contained in:
@@ -20,7 +20,7 @@ CPPFLAGS = -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6
|
||||
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
|
||||
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
|
||||
|
||||
CXXFLAGS = -O2 -g0 -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 \
|
||||
CXXFLAGS = -O2 -Wall -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 \
|
||||
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
|
||||
|
||||
all: espeakedit
|
||||
|
||||
@@ -1264,7 +1264,6 @@ static int NextItem(int type)
|
||||
unsigned char c2;
|
||||
int ix;
|
||||
int sign;
|
||||
int keyword;
|
||||
char *p;
|
||||
keywtab_t *pk;
|
||||
|
||||
@@ -1332,8 +1331,6 @@ static int NextItem(int type)
|
||||
if(!feof(f_in))
|
||||
unget_char(c);
|
||||
|
||||
keyword = -1;
|
||||
|
||||
if(type == tSTRING)
|
||||
{
|
||||
return(0);
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
#include "synthesize.h"
|
||||
#include "translate.h"
|
||||
|
||||
//#define OPT_FORMAT // format the text and write formatted copy to Log file
|
||||
//#define OUTPUT_FORMAT
|
||||
|
||||
extern void Write4Bytes(FILE *f, int value);
|
||||
int HashDictionary(const char *string);
|
||||
|
||||
@@ -390,13 +387,11 @@ static int compile_line(char *linebuf, char *dict_line, int *hash)
|
||||
int all_upper_case;
|
||||
|
||||
char *mnemptr;
|
||||
char *comment;
|
||||
unsigned char flag_codes[100];
|
||||
char encoded_ph[200];
|
||||
unsigned char bad_phoneme[4];
|
||||
static char nullstring[] = {0};
|
||||
|
||||
comment = NULL;
|
||||
text_not_phonemes = 0;
|
||||
phonetic = word = nullstring;
|
||||
|
||||
@@ -497,7 +492,6 @@ step=1; // TEST
|
||||
if((c == '/') && (p[1] == '/') && (multiple_words==0))
|
||||
{
|
||||
c = '\n'; /* "//" treat comment as end of line */
|
||||
comment = p;
|
||||
}
|
||||
|
||||
switch(step)
|
||||
@@ -591,12 +585,6 @@ step=1; // TEST
|
||||
|
||||
if(word[0] == 0)
|
||||
{
|
||||
#ifdef OPT_FORMAT
|
||||
if(comment != NULL)
|
||||
fprintf(f_log,"%s",comment);
|
||||
else
|
||||
fputc('\n',f_log);
|
||||
#endif
|
||||
return(0); /* blank line */
|
||||
}
|
||||
|
||||
@@ -747,35 +735,6 @@ step=1; // TEST
|
||||
}
|
||||
dict_line[0] = length;
|
||||
|
||||
#ifdef OPT_FORMAT
|
||||
spaces = 16;
|
||||
for(ix=0; ix<n_flag_codes; ix++)
|
||||
{
|
||||
if(flag_codes[ix] >= 100)
|
||||
{
|
||||
fprintf(f_log,"?%d ",flag_codes[ix]-100);
|
||||
spaces -= 3;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f_log,"%s",word);
|
||||
spaces -= strlen(word);
|
||||
DecodePhonemes(encoded_ph,decoded_ph);
|
||||
while(spaces-- > 0) fputc(' ',f_log);
|
||||
spaces += (14 - strlen(decoded_ph));
|
||||
|
||||
fprintf(f_log," %s",decoded_ph);
|
||||
while(spaces-- > 0) fputc(' ',f_log);
|
||||
for(ix=0; ix<n_flag_codes; ix++)
|
||||
{
|
||||
if(flag_codes[ix] < 100)
|
||||
fprintf(f_log," %s",lookup_mnem(mnem_flags,flag_codes[ix]));
|
||||
}
|
||||
if(comment != NULL)
|
||||
fprintf(f_log," %s",comment);
|
||||
else
|
||||
fputc('\n',f_log);
|
||||
#endif
|
||||
|
||||
return(length);
|
||||
} /* end of compile_line */
|
||||
@@ -1160,7 +1119,6 @@ static char *compile_rule(char *input)
|
||||
int start;
|
||||
int state=2;
|
||||
int finish=0;
|
||||
int pre_bracket=0;
|
||||
char buf[80];
|
||||
char output[150];
|
||||
unsigned char bad_phoneme[4];
|
||||
@@ -1183,7 +1141,6 @@ static char *compile_rule(char *input)
|
||||
case ')': // end of prefix section
|
||||
*p = 0;
|
||||
state = 1;
|
||||
pre_bracket = 1;
|
||||
copy_rule_string(buf,state);
|
||||
p = buf;
|
||||
break;
|
||||
|
||||
+6
-16
@@ -832,7 +832,6 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
int vowel_posn=9;
|
||||
int index;
|
||||
int count;
|
||||
int apostrophe=0;
|
||||
|
||||
utf8_in(&c,word);
|
||||
if((tr->letter_bits_offset > 0) && (c < 0x241))
|
||||
@@ -868,10 +867,7 @@ int Unpronouncable(Translator *tr, char *word, int posn)
|
||||
break;
|
||||
}
|
||||
|
||||
if(c == '\'')
|
||||
apostrophe = 1;
|
||||
else
|
||||
if(!iswalpha(c))
|
||||
if((c != '\'') && !iswalpha(c))
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1123,7 +1119,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
int final_ph2;
|
||||
int mnem;
|
||||
int mnem2;
|
||||
int post_tonic;
|
||||
int post_tonic; // currently not used
|
||||
int opt_length;
|
||||
int done;
|
||||
int stressflags;
|
||||
@@ -1387,7 +1383,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
{
|
||||
int wt;
|
||||
int max_weight = -1;
|
||||
int prev_stressed;
|
||||
// int prev_stressed;
|
||||
|
||||
// find the heaviest syllable, excluding the final syllable
|
||||
for(ix = 1; ix < (vowel_count-1); ix++)
|
||||
@@ -1397,7 +1393,7 @@ void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags,
|
||||
if((wt = syllable_weight[ix]) >= max_weight)
|
||||
{
|
||||
max_weight = wt;
|
||||
prev_stressed = stressed_syllable;
|
||||
// prev_stressed = stressed_syllable;
|
||||
stressed_syllable = ix;
|
||||
}
|
||||
}
|
||||
@@ -2166,7 +2162,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_
|
||||
// next 3 bytes are a (non-zero) ending type. 2 bytes of flags + suffix length
|
||||
end_type = (rule[0] << 16) + ((rule[1] & 0x7f) << 8) + (rule[2] & 0x7f);
|
||||
|
||||
if((tr->word_vowel_count == 0) && !(end_type & SUFX_P))
|
||||
if((tr->word_vowel_count == 0) && !(end_type & SUFX_P) && (tr->langopts.param[LOPT_SUFFIX] & 1))
|
||||
failed = 1; // don't match a suffix rule if there are no previous syllables (needed for lang=tr).
|
||||
else
|
||||
{
|
||||
@@ -2435,9 +2431,8 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
Append the result to 'phonemes' and any standard prefix/suffix in 'end_phonemes' */
|
||||
|
||||
unsigned char c, c2;
|
||||
unsigned int c12, c123;
|
||||
unsigned int c12;
|
||||
int wc=0;
|
||||
int wc_prev;
|
||||
int wc_bytes;
|
||||
char *p2; /* copy of p for use in double letter chain match */
|
||||
int found;
|
||||
@@ -2497,7 +2492,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
|
||||
while(((c = *p) != ' ') && (c != 0))
|
||||
{
|
||||
wc_prev = wc;
|
||||
wc_bytes = utf8_in(&wc,p);
|
||||
if(IsAlpha(wc))
|
||||
any_alpha++;
|
||||
@@ -2540,7 +2534,6 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c
|
||||
/* there are some 2 byte chains for this initial letter */
|
||||
c2 = p[1];
|
||||
c12 = c + (c2 << 8); /* 2 characters */
|
||||
c123 = c12 + (p[2] << 16);
|
||||
|
||||
g1 = tr->groups2_start[c];
|
||||
for(g=g1; g < (g1+n); g++)
|
||||
@@ -3213,13 +3206,10 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
|
||||
if(option_phonemes == 2)
|
||||
{
|
||||
unsigned int flags1 = 0;
|
||||
char ph_decoded[N_WORD_PHONEMES];
|
||||
int textmode;
|
||||
|
||||
DecodePhonemes(phonetic,ph_decoded);
|
||||
if(flags != NULL)
|
||||
flags1 = flags[0];
|
||||
|
||||
if((dictionary_flags & FLAG_TEXTMODE) == 0)
|
||||
textmode = 0;
|
||||
|
||||
@@ -127,7 +127,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
const char *p;
|
||||
int len;
|
||||
int count;
|
||||
int scores = 0;
|
||||
const espeak_VOICE *v;
|
||||
const char *lang_name;
|
||||
char age_buf[12];
|
||||
@@ -144,7 +143,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
voice_select.gender = 0;
|
||||
voice_select.name = NULL;
|
||||
voices = espeak_ListVoices(&voice_select);
|
||||
scores = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,8 +177,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
count++;
|
||||
p += len+2;
|
||||
}
|
||||
// if(scores)
|
||||
// fprintf(f_out,"%3d ",v->score);
|
||||
fputc('\n',f_out);
|
||||
}
|
||||
} // end of DisplayVoices
|
||||
@@ -391,14 +387,10 @@ int main (int argc, char **argv)
|
||||
espeak_VOICE voice_select;
|
||||
char filename[200];
|
||||
char voicename[40];
|
||||
char voice_mbrola[20];
|
||||
char dictname[40];
|
||||
#define N_PUNCTLIST 100
|
||||
wchar_t option_punctlist[N_PUNCTLIST];
|
||||
|
||||
voicename[0] = 0;
|
||||
voice_mbrola[0] = 0;
|
||||
dictname[0] = 0;
|
||||
wavefile[0] = 0;
|
||||
filename[0] = 0;
|
||||
option_punctlist[0] = 0;
|
||||
|
||||
+5
-1
@@ -386,13 +386,17 @@ static int sleep_until_timeout_or_stop_request(uint32_t time_in_ms)
|
||||
ENTER("sleep_until_timeout_or_stop_request");
|
||||
|
||||
int a_stop_is_required=0;
|
||||
struct timespec ts, to;
|
||||
struct timespec ts;
|
||||
struct timeval tv;
|
||||
int err=0;
|
||||
|
||||
clock_gettime2( &ts);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
struct timespec to;
|
||||
to.tv_sec = ts.tv_sec;
|
||||
to.tv_nsec = ts.tv_nsec;
|
||||
#endif
|
||||
|
||||
add_time_in_ms( &ts, time_in_ms);
|
||||
|
||||
|
||||
+8
-13
@@ -325,7 +325,7 @@ void Lexicon_It(int pass)
|
||||
char buf_out[200];
|
||||
char buf_error[200];
|
||||
char last_listx[200];
|
||||
int test;
|
||||
|
||||
static const char *vowels1 = "aeiou";
|
||||
static const char *vowels2 = "aeou";
|
||||
|
||||
@@ -913,7 +913,6 @@ void Lexicon_Bg()
|
||||
char *pw;
|
||||
char *pw1;
|
||||
int cc;
|
||||
int ix;
|
||||
int vcount;
|
||||
int lex_stress;
|
||||
int input_length;
|
||||
@@ -929,7 +928,6 @@ void Lexicon_Bg()
|
||||
|
||||
FILE *f_in;
|
||||
FILE *f_out;
|
||||
FILE *f_log;
|
||||
|
||||
char word[80];
|
||||
char word_in[80];
|
||||
@@ -967,9 +965,6 @@ void Lexicon_Bg()
|
||||
return;
|
||||
}
|
||||
|
||||
// sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"bg_log");
|
||||
// f_log = fopen(fname,"w");
|
||||
|
||||
LoadVoice("bg",0);
|
||||
progress = new wxProgressDialog(_T("Lexicon"),_T(""),input_length);
|
||||
|
||||
@@ -1107,7 +1102,6 @@ if(n_stress > 1) n_stress = 1;
|
||||
|
||||
fclose(f_in);
|
||||
fclose(f_out);
|
||||
// fclose(f_log);
|
||||
|
||||
CompileDictionary(path_dsource,"bg",NULL,NULL,0);
|
||||
|
||||
@@ -1138,7 +1132,6 @@ void Lexicon_Ru()
|
||||
FILE *f_in;
|
||||
FILE *f_out;
|
||||
FILE *f_log;
|
||||
FILE *f_roots;
|
||||
PHONEME_TAB *ph;
|
||||
int ph_code;
|
||||
int vcount;
|
||||
@@ -1151,10 +1144,6 @@ void Lexicon_Ru()
|
||||
int wlength;
|
||||
int input_length;
|
||||
|
||||
int sfx;
|
||||
const char *suffix;
|
||||
int wlen;
|
||||
int len;
|
||||
int check_root;
|
||||
|
||||
char word[80];
|
||||
@@ -1173,6 +1162,12 @@ void Lexicon_Ru()
|
||||
int syllables;
|
||||
} SUFFIX;
|
||||
|
||||
#ifdef deleted
|
||||
FILE *f_roots;
|
||||
int sfx;
|
||||
const char *suffix;
|
||||
int wlen;
|
||||
int len;
|
||||
static SUFFIX suffixes[] = {
|
||||
{NULL,0},
|
||||
{"ичу",2},
|
||||
@@ -1192,7 +1187,7 @@ void Lexicon_Ru()
|
||||
{"и",1},
|
||||
|
||||
{NULL,0}};
|
||||
|
||||
#endif
|
||||
|
||||
memset(counts,0,sizeof(counts));
|
||||
|
||||
|
||||
+42
-38
@@ -281,48 +281,52 @@ static int sleep_until_start_request_or_inactivity()
|
||||
// for filtering underflow.
|
||||
//
|
||||
int i=0;
|
||||
while((i<= MAX_INACTIVITY_CHECK) && !a_start_is_required)
|
||||
{
|
||||
if (wave_is_busy( NULL) )
|
||||
while((i<= MAX_INACTIVITY_CHECK) && !a_start_is_required)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
if (wave_is_busy( NULL) )
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
int err=0;
|
||||
struct timespec ts, to;
|
||||
struct timeval tv;
|
||||
|
||||
clock_gettime2( &ts);
|
||||
to.tv_sec = ts.tv_sec;
|
||||
to.tv_nsec = ts.tv_nsec;
|
||||
|
||||
add_time_in_ms( &ts, INACTIVITY_TIMEOUT);
|
||||
|
||||
SHOW("fifo > sleep_until_start_request_or_inactivity > start sem_timedwait (start_is_required) from %d.%09lu to %d.%09lu \n",
|
||||
to.tv_sec, to.tv_nsec,
|
||||
ts.tv_sec, ts.tv_nsec);
|
||||
|
||||
while ((err = sem_timedwait(&my_sem_start_is_required, &ts)) == -1
|
||||
&& errno == EINTR)
|
||||
{
|
||||
continue;
|
||||
int err=0;
|
||||
struct timespec ts;
|
||||
struct timeval tv;
|
||||
|
||||
clock_gettime2( &ts);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
struct timespec to;
|
||||
to.tv_sec = ts.tv_sec;
|
||||
to.tv_nsec = ts.tv_nsec;
|
||||
#endif
|
||||
|
||||
add_time_in_ms( &ts, INACTIVITY_TIMEOUT);
|
||||
|
||||
SHOW("fifo > sleep_until_start_request_or_inactivity > start sem_timedwait (start_is_required) from %d.%09lu to %d.%09lu \n",
|
||||
to.tv_sec, to.tv_nsec,
|
||||
ts.tv_sec, ts.tv_nsec);
|
||||
|
||||
while ((err = sem_timedwait(&my_sem_start_is_required, &ts)) == -1
|
||||
&& errno == EINTR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assert (gettimeofday(&tv, NULL) != -1);
|
||||
SHOW("fifo > sleep_until_start_request_or_inactivity > stop sem_timedwait (start_is_required, err=%d) %d.%09lu \n", err,
|
||||
tv.tv_sec, tv.tv_usec*1000);
|
||||
|
||||
if (err==0)
|
||||
{
|
||||
a_start_is_required = 1;
|
||||
}
|
||||
}
|
||||
|
||||
assert (gettimeofday(&tv, NULL) != -1);
|
||||
SHOW("fifo > sleep_until_start_request_or_inactivity > stop sem_timedwait (start_is_required, err=%d) %d.%09lu \n", err,
|
||||
tv.tv_sec, tv.tv_usec*1000);
|
||||
|
||||
if (err==0)
|
||||
{
|
||||
a_start_is_required = 1;
|
||||
}
|
||||
}
|
||||
SHOW_TIME("fifo > sleep_until_start_request_or_inactivity > LEAVE");
|
||||
return a_start_is_required;
|
||||
SHOW_TIME("fifo > sleep_until_start_request_or_inactivity > LEAVE");
|
||||
return a_start_is_required;
|
||||
}
|
||||
|
||||
//>
|
||||
|
||||
+2
-8
@@ -787,10 +787,6 @@ static int calc_pitches2(int start, int end, int tune_number)
|
||||
int ix;
|
||||
TUNE *tune;
|
||||
int drop;
|
||||
int continuing = 0;
|
||||
|
||||
if(start > 0)
|
||||
continuing = 1;
|
||||
|
||||
tune = &tunes[tune_number];
|
||||
ix = start;
|
||||
@@ -941,7 +937,7 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
PHONEME_TAB *tph;
|
||||
PHONEME_TAB *prev_tph; // forget across word boundary
|
||||
PHONEME_TAB *prevw_tph; // remember across word boundary
|
||||
PHONEME_TAB *prev2_tph; // 2 tones previous
|
||||
// PHONEME_TAB *prev2_tph; // 2 tones previous
|
||||
PHONEME_LIST *prev_p;
|
||||
|
||||
int pitch_adjust = 0; // pitch gradient through the clause - inital value
|
||||
@@ -949,8 +945,6 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
int pitch_low = 0; // until it drops to this
|
||||
int pitch_high = 0; // then reset to this
|
||||
|
||||
p = &phoneme_list[0];
|
||||
|
||||
// count number of stressed syllables
|
||||
p = &phoneme_list[0];
|
||||
for(ix=0; ix<n_phoneme_list; ix++, p++)
|
||||
@@ -1066,7 +1060,7 @@ static void CalcPitches_Tone(Translator *tr, int clause_tone)
|
||||
}
|
||||
|
||||
prev_p = p;
|
||||
prev2_tph = prevw_tph;
|
||||
// prev2_tph = prevw_tph;
|
||||
prevw_tph = prev_tph = tph;
|
||||
pause = 0;
|
||||
}
|
||||
|
||||
+15
-9
@@ -883,12 +883,10 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
|
||||
double arg;
|
||||
|
||||
f = -f;
|
||||
|
||||
if(f>=0)
|
||||
{
|
||||
f = -1;
|
||||
}
|
||||
|
||||
|
||||
//NOTE, changes made 30.09.2011 for Reece Dunn <msclrhd@googlemail.com>
|
||||
// fix a sound spike when f=0
|
||||
|
||||
/* First compute ordinary resonator coefficients */
|
||||
/* Let r = exp(-pi bw t) */
|
||||
arg = kt_globals.minus_pi_t * bw;
|
||||
@@ -905,9 +903,17 @@ static void setzeroabc(long int f, long int bw, resonator_ptr rp)
|
||||
rp->a = 1.0 - rp->b - rp->c;
|
||||
|
||||
/* Now convert to antiresonator coefficients (a'=1/a, b'=b/a, c'=c/a) */
|
||||
rp->a = 1.0 / rp->a;
|
||||
rp->c *= -rp->a;
|
||||
rp->b *= -rp->a;
|
||||
/* If f == 0 then rp->a gets set to 0 which makes a'=1/a set a', b' and c' to
|
||||
* INF, causing an audible sound spike when triggered (e.g. apiration with the
|
||||
* nasal register set to f=0, bw=0).
|
||||
*/
|
||||
if (rp->a != 0)
|
||||
{
|
||||
/* Now convert to antiresonator coefficients (a'=1/a, b'=b/a, c'=c/a) */
|
||||
rp->a = 1.0 / rp->a;
|
||||
rp->c *= -rp->a;
|
||||
rp->b *= -rp->a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ static int start_mbrola(const char *voice_path)
|
||||
snprintf(mbr_errorbuf, sizeof(mbr_errorbuf),
|
||||
"dup2(): %s\n", strerror(errno));
|
||||
written = write(p_stderr[1], mbr_errorbuf, strlen(mbr_errorbuf));
|
||||
(void)written; // suppress 'variable not used' warning
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
@@ -170,6 +171,7 @@ static int start_mbrola(const char *voice_path)
|
||||
snprintf(mbr_errorbuf, sizeof(mbr_errorbuf),
|
||||
"mbrola: %s\n", strerror(errno));
|
||||
written = write(2, mbr_errorbuf, strlen(mbr_errorbuf));
|
||||
(void)written; // suppress 'variable not used' warning
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -506,7 +506,6 @@ void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_b
|
||||
static char single_letter[10] = {0,0};
|
||||
unsigned int dict_flags[2];
|
||||
char ph_buf3[40];
|
||||
char *ptr;
|
||||
|
||||
ph_buf1[0] = 0;
|
||||
len = utf8_out(letter,&single_letter[2]);
|
||||
@@ -552,7 +551,6 @@ void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_b
|
||||
|
||||
// if the $accent flag is set for this letter, use the accents table (below)
|
||||
dict_flags[1] = 0;
|
||||
ptr = &single_letter[1];
|
||||
|
||||
if(Lookup(tr, &single_letter[1], ph_buf3) == 0)
|
||||
{
|
||||
@@ -1586,7 +1584,6 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
int decimal_count;
|
||||
int max_decimal_count;
|
||||
int decimal_mode;
|
||||
int hyphen;
|
||||
int suffix_ix;
|
||||
int skipwords = 0;
|
||||
char *p;
|
||||
@@ -1651,12 +1648,10 @@ static int TranslateNumber_1(Translator *tr, char *word, char *ph_out, unsigned
|
||||
// NOTE lang=hu, allow both dot and ordinal suffix, eg. "december 21.-én"
|
||||
// look for an ordinal number suffix after the number
|
||||
ix++;
|
||||
hyphen = 0;
|
||||
p = suffix;
|
||||
if(wtab[0].flags & FLAG_HYPHEN_AFTER)
|
||||
{
|
||||
*p++ = '-';
|
||||
hyphen = 1;
|
||||
ix++;
|
||||
}
|
||||
while((word[ix] != 0) && (word[ix] != ' ') && (ix < (int)(sizeof(suffix)-1)))
|
||||
|
||||
+2
-9
@@ -114,7 +114,7 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
int insert_ph = 0;
|
||||
PHONEME_LIST *phlist;
|
||||
PHONEME_TAB *ph;
|
||||
PHONEME_TAB *prev, *next, *next2;
|
||||
PHONEME_TAB *next, *next2;
|
||||
int unstress_count = 0;
|
||||
int word_stress = 0;
|
||||
int switched_language = 0;
|
||||
@@ -123,7 +123,6 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
int regression;
|
||||
int end_sourceix;
|
||||
int alternative;
|
||||
int first_vowel=0; // first vowel in a word
|
||||
PHONEME_DATA phdata;
|
||||
|
||||
int n_ph_list3;
|
||||
@@ -131,8 +130,7 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
PHONEME_LIST *plist3_inserted = NULL;
|
||||
PHONEME_LIST ph_list3[N_PHONEME_LIST];
|
||||
|
||||
static PHONEME_LIST2 ph_list2_null = {0,0,0,0,0,0};
|
||||
PHONEME_LIST2 *plist2 = &ph_list2_null;
|
||||
PHONEME_LIST2 *plist2;
|
||||
|
||||
plist2 = ph_list2;
|
||||
phlist = phoneme_list;
|
||||
@@ -302,8 +300,6 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
|
||||
for(j=0; insert_ph || ((j < n_ph_list3) && (ix < N_PHONEME_LIST-3)); j++)
|
||||
{
|
||||
prev = ph;
|
||||
|
||||
plist3 = &ph_list3[j];
|
||||
|
||||
if(insert_ph != 0)
|
||||
@@ -448,9 +444,6 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
}
|
||||
}
|
||||
|
||||
if(ph->type == phVOWEL)
|
||||
first_vowel = 0;
|
||||
|
||||
if((plist3+1)->synthflags & SFLAG_LENGTHEN)
|
||||
{
|
||||
static char types_double[] = {phFRICATIVE,phVFRICATIVE,phNASAL,phLIQUID,0};
|
||||
|
||||
+3
-6
@@ -472,10 +472,8 @@ static int GetC(void)
|
||||
int cbuf[4];
|
||||
int ix;
|
||||
int n_bytes;
|
||||
unsigned char m;
|
||||
static int ungot2 = 0;
|
||||
static const unsigned char mask[4] = {0xff,0x1f,0x0f,0x07};
|
||||
static const unsigned char mask2[4] = {0,0x80,0x20,0x30};
|
||||
|
||||
if((c1 = ungot_char) != 0)
|
||||
{
|
||||
@@ -516,7 +514,6 @@ static int GetC(void)
|
||||
if((ix = n_bytes) > 0)
|
||||
{
|
||||
c = c1 & mask[ix];
|
||||
m = mask2[ix];
|
||||
while(ix > 0)
|
||||
{
|
||||
if((c2 = cbuf[ix] = GetC_get()) == 0)
|
||||
@@ -535,7 +532,6 @@ static int GetC(void)
|
||||
GetC_unget(c2);
|
||||
break;
|
||||
}
|
||||
m = 0x80;
|
||||
c = (c << 6) + (c2 & 0x3f);
|
||||
ix--;
|
||||
}
|
||||
@@ -1435,6 +1431,9 @@ void SetVoiceStack(espeak_VOICE *v, const char *variant_name)
|
||||
sp->voice_variant_number = v->variant;
|
||||
sp->voice_age = v->age;
|
||||
sp->voice_gender = v->gender;
|
||||
|
||||
if(memcmp(variant_name, "!v/", 3) == 0)
|
||||
variant_name += 3;// strip variant directory name
|
||||
strncpy0(base_voice_variant_name, variant_name, sizeof(base_voice_variant_name));
|
||||
memcpy(&base_voice, ¤t_voice_selected, sizeof(base_voice));
|
||||
}
|
||||
@@ -2094,7 +2093,6 @@ int ReadClause(Translator *tr, FILE *f_in, char *buf, short *charix, int *charix
|
||||
int punct_data = 0;
|
||||
int is_end_clause;
|
||||
int announced_punctuation = 0;
|
||||
int prev_announced_punctuation;
|
||||
int stressed_word = 0;
|
||||
int end_clause_after_tag = 0;
|
||||
int end_clause_index = 0;
|
||||
@@ -2502,7 +2500,6 @@ if(option_ssml) parag=1;
|
||||
linelength = 0;
|
||||
}
|
||||
|
||||
prev_announced_punctuation = announced_punctuation;
|
||||
announced_punctuation = 0;
|
||||
|
||||
if((phoneme_mode==0) && (sayas_mode==0))
|
||||
|
||||
@@ -159,7 +159,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
const char *p;
|
||||
int len;
|
||||
int count;
|
||||
int scores = 0;
|
||||
const espeak_VOICE *v;
|
||||
const char *lang_name;
|
||||
char age_buf[12];
|
||||
@@ -176,7 +175,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
voice_select.gender = 0;
|
||||
voice_select.name = NULL;
|
||||
voices = espeak_ListVoices(&voice_select);
|
||||
scores = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -211,8 +209,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
count++;
|
||||
p += len+2;
|
||||
}
|
||||
// if(scores)
|
||||
// fprintf(f_out,"%3d ",v->score);
|
||||
fputc('\n',f_out);
|
||||
}
|
||||
} // end of DisplayVoices
|
||||
@@ -511,11 +507,9 @@ int main (int argc, char **argv)
|
||||
espeak_VOICE voice_select;
|
||||
char filename[200];
|
||||
char voicename[40];
|
||||
char dictname[40];
|
||||
|
||||
voicename[0] = 0;
|
||||
mbrola_name[0] = 0;
|
||||
dictname[0] = 0;
|
||||
wavefile[0] = 0;
|
||||
filename[0] = 0;
|
||||
option_linelength = 0;
|
||||
|
||||
@@ -95,11 +95,9 @@ static int dispatch_audio(short* outbuf, int length, espeak_EVENT* event)
|
||||
case AUDIO_OUTPUT_PLAYBACK:
|
||||
{
|
||||
int event_type=0;
|
||||
int event_data=0;
|
||||
if(event)
|
||||
{
|
||||
event_type = event->type;
|
||||
event_data = event->id.number;
|
||||
}
|
||||
|
||||
if(event_type == espeakEVENT_SAMPLERATE)
|
||||
|
||||
@@ -533,7 +533,6 @@ void SpectDisplay::OnKey(wxKeyEvent& event)
|
||||
int keyfr;
|
||||
int control;
|
||||
int number;
|
||||
double value;
|
||||
SpectFrame *sf;
|
||||
peak_t *pk;
|
||||
// static short pk_inc1[N_PEAKS] = {2,2,2,5,5,5,5,5,5};
|
||||
@@ -785,10 +784,6 @@ void SpectDisplay::OnKey(wxKeyEvent& event)
|
||||
display = 3;
|
||||
break;
|
||||
|
||||
case 0x1052: // CTRL-R
|
||||
value = sf->GetRms(spectseq->amplitude);
|
||||
break;
|
||||
|
||||
case 0x1053: // CTRL-S
|
||||
Save(savepath);
|
||||
break;
|
||||
@@ -1023,7 +1018,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& event)
|
||||
else
|
||||
path_spectload2 = path.GetPath();
|
||||
|
||||
// Make another frame, containing a canvas
|
||||
// Make another frame, containing a canvas
|
||||
GetClientSize(&width, &height);
|
||||
MyChild *subframe = new MyChild(myframe, _T("Spectrum"),
|
||||
wxPoint(10, 0), wxSize(500, height),
|
||||
|
||||
+2
-9
@@ -462,14 +462,13 @@ int SpectSeq::ImportSPC2(wxInputStream & stream)
|
||||
int n_cycles = 0;
|
||||
int x;
|
||||
CYCLE cy;
|
||||
int pos;
|
||||
|
||||
/* count number of cycles */
|
||||
while(!stream.Eof())
|
||||
{
|
||||
pos = stream.TellI();
|
||||
stream.TellI();
|
||||
stream.Read(&cy,44);
|
||||
pos = stream.TellI();
|
||||
stream.TellI();
|
||||
if(stream.Eof()) break;
|
||||
|
||||
n_cycles++;
|
||||
@@ -993,7 +992,6 @@ void SpectSeq::MakeWave(int start, int end, PitchEnvelope &pitch)
|
||||
float sum_length=0;
|
||||
float prev_length=0;
|
||||
int first;
|
||||
int pbase;
|
||||
char *fname_speech;
|
||||
SpectFrame *sp1 = NULL;
|
||||
SpectFrame *sp2;
|
||||
@@ -1033,7 +1031,6 @@ void SpectSeq::MakeWave(int start, int end, PitchEnvelope &pitch)
|
||||
}
|
||||
|
||||
total_length = int(sum_length);
|
||||
pbase = voice->pitch_base >> 12;
|
||||
|
||||
if((start==end) || (total_length == 0))
|
||||
{
|
||||
@@ -1117,8 +1114,6 @@ void SpectFrame::MakeWaveF(int control, PitchEnvelope &pitche, int amplitude, in
|
||||
int y;
|
||||
peak_t peaks0[N_PEAKS];
|
||||
peak_t peaks1[N_PEAKS];
|
||||
int ipitch;
|
||||
int pbase;
|
||||
char *fname_speech;
|
||||
int synthesizer_type = 0;
|
||||
|
||||
@@ -1131,12 +1126,10 @@ void SpectFrame::MakeWaveF(int control, PitchEnvelope &pitche, int amplitude, in
|
||||
SpeakNextClause(NULL,NULL,2); // stop speaking file
|
||||
|
||||
length = duration;
|
||||
ipitch = int(pitch) << 16;
|
||||
if(length==0)
|
||||
length = 200; // default length, mS
|
||||
|
||||
len_samples = (length * samplerate) / 1000;
|
||||
pbase = voice->pitch_base >> 12;
|
||||
SetPitch(len_samples + 50,pitche.env,9,44);
|
||||
|
||||
fname_speech = WavFileName();
|
||||
|
||||
@@ -413,7 +413,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
PHONEME_TAB *ph_prev;
|
||||
PHONEME_LIST *p;
|
||||
PHONEME_LIST *next;
|
||||
PHONEME_LIST *prev;
|
||||
PHONEME_DATA phdata;
|
||||
FMT_PARAMS fmtp;
|
||||
int pause = 0;
|
||||
@@ -445,7 +444,6 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, int resume, FILE *f_mbr
|
||||
|
||||
p = &plist[phix];
|
||||
next = &plist[phix+1];
|
||||
prev = &plist[phix-1];
|
||||
ph = p->ph;
|
||||
ph_prev = plist[phix-1].ph;
|
||||
ph_next = plist[phix+1].ph;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.45.44 16.Sep.11";
|
||||
const char *version_string = "1.45.45 07.Oct.11";
|
||||
const int version_phdata = 0x014500;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -1319,7 +1319,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
unsigned char *pitch_env=NULL;
|
||||
unsigned char *amp_env;
|
||||
PHONEME_TAB *ph;
|
||||
PHONEME_TAB *prev_ph;
|
||||
static int sourceix=0;
|
||||
|
||||
PHONEME_DATA phdata;
|
||||
@@ -1605,10 +1604,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
if(p->ph->phflags & phTRILL)
|
||||
modulation = 5;
|
||||
|
||||
prev_ph = prev->ph;
|
||||
// if(p->newword)
|
||||
// prev_ph = phoneme_tab[phonPAUSE]; // pronounce fully at the start of a word
|
||||
|
||||
if(!(p->synthflags & SFLAG_SEQCONTINUE))
|
||||
{
|
||||
DoAmplitude(p->amp,NULL);
|
||||
|
||||
@@ -1262,6 +1262,7 @@ SetLengthMods(tr,3); // all equal
|
||||
|
||||
tr->langopts.stress_rule = 7; // stress on the last syllable, before any explicitly unstressed syllable
|
||||
tr->langopts.stress_flags = 0x20; //no automatic secondary stress
|
||||
tr->langopts.param[LOPT_SUFFIX] = 1;
|
||||
|
||||
if(name2 == L('a','z'))
|
||||
{
|
||||
|
||||
@@ -798,7 +798,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
int prefix_stress;
|
||||
char *wordx;
|
||||
char phonemes[N_WORD_PHONEMES];
|
||||
char *ph_limit;
|
||||
char prefix_phonemes[N_WORD_PHONEMES];
|
||||
char unpron_phonemes[N_WORD_PHONEMES];
|
||||
char end_phonemes[N_WORD_PHONEMES];
|
||||
@@ -846,7 +845,6 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
unpron_phonemes[0] = 0;
|
||||
prefix_phonemes[0] = 0;
|
||||
end_phonemes[0] = 0;
|
||||
ph_limit = &phonemes[N_WORD_PHONEMES];
|
||||
|
||||
if(tr->data_dictlist == NULL)
|
||||
{
|
||||
@@ -2366,7 +2364,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
int prev_in;
|
||||
int prev_out=' ';
|
||||
int prev_out2;
|
||||
int prev_in2=0;
|
||||
int prev_in_save=0;
|
||||
int next_in;
|
||||
int next_in_nbytes;
|
||||
@@ -2390,7 +2387,6 @@ void *TranslateClause(Translator *tr, FILE *f_text, const void *vp_input, int *t
|
||||
char *p;
|
||||
int j, k;
|
||||
int n_digits;
|
||||
int individual_digits;
|
||||
int charix_top=0;
|
||||
|
||||
short charix[N_TR_SOURCE+4];
|
||||
@@ -2541,7 +2537,6 @@ p = source;
|
||||
else
|
||||
if(source_index > 0)
|
||||
{
|
||||
prev_in2 = prev_in;
|
||||
utf8_in2(&prev_in,&source[source_index-1],1); // prev_in = source[source_index-1];
|
||||
}
|
||||
|
||||
@@ -3137,7 +3132,6 @@ if((c == '/') && (tr->langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(pre
|
||||
pn = &number_buf[1];
|
||||
nx = n_digits;
|
||||
nw = 0;
|
||||
individual_digits = 0;
|
||||
|
||||
if((n_digits > tr->langopts.max_digits) || (word[0] == '0'))
|
||||
words[ix].flags |= FLAG_INDIVIDUAL_DIGITS;
|
||||
|
||||
+4
-1
@@ -256,7 +256,7 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
|
||||
|
||||
|
||||
#define N_LOPTS 19
|
||||
#define N_LOPTS 20
|
||||
#define LOPT_DIERESES 1
|
||||
// 1=remove [:] from unstressed syllables, 2= remove from unstressed or non-penultimate syllables
|
||||
// bit 4=0, if stress < 4, bit 4=1, if not the highest stress in the word
|
||||
@@ -323,6 +323,9 @@ extern const int param_defaults[N_SPEECH_PARAM];
|
||||
// recognize long vowels (0 = don't recognize)
|
||||
#define LOPT_LONG_VOWEL_THRESHOLD 18
|
||||
|
||||
// bit 0: Don't allow suffices if there is no previous syllable
|
||||
#define LOPT_SUFFIX 19
|
||||
|
||||
|
||||
// stress_rule
|
||||
#define STRESSPOSN_1L 0 // 1st syllable
|
||||
|
||||
+1
-2
@@ -532,7 +532,6 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
int n;
|
||||
int value;
|
||||
int value2;
|
||||
int error = 0;
|
||||
int langix = 0;
|
||||
int tone_only = control & 2;
|
||||
int language_set = 0;
|
||||
@@ -986,7 +985,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
}
|
||||
voice->phoneme_tab_ix = ix;
|
||||
new_translator->phoneme_tab_ix = ix;
|
||||
error = LoadDictionary(new_translator, new_dictionary, control & 4);
|
||||
LoadDictionary(new_translator, new_dictionary, control & 4);
|
||||
if(dictionary_name[0]==0)
|
||||
return(NULL); // no dictionary loaded
|
||||
|
||||
|
||||
@@ -391,7 +391,6 @@ void FindPhonemesUsed(void)
|
||||
int hash;
|
||||
char *p;
|
||||
unsigned int *pw;
|
||||
char *start;
|
||||
char *next;
|
||||
unsigned char c;
|
||||
int count = 0;
|
||||
@@ -449,7 +448,6 @@ void FindPhonemesUsed(void)
|
||||
if(c == RULE_PHONEMES)
|
||||
{
|
||||
ignore = 0;
|
||||
start = p;
|
||||
p++;
|
||||
while((c = *p) != 0)
|
||||
{
|
||||
@@ -592,7 +590,6 @@ void MakeVowelLists(void)
|
||||
int colour;
|
||||
int voice_found;
|
||||
PHONEME_PROG_LOG *prog_log_table;
|
||||
PHONEME_PROG_LOG *prog_log_end;
|
||||
PHONEME_PROG_LOG *found_prog;
|
||||
PHONEME_PROG_LOG this_prog;
|
||||
char dirname[sizeof(path_source)+20];
|
||||
@@ -613,7 +610,6 @@ void MakeVowelLists(void)
|
||||
return;
|
||||
ix = fread(prog_log_table, 1, ix, f_prog_log);
|
||||
fclose(f_prog_log);
|
||||
prog_log_end = prog_log_table + ix;
|
||||
n_prog_log = ix / sizeof(PHONEME_PROG_LOG);
|
||||
|
||||
progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables);
|
||||
|
||||
+1
-1
@@ -606,7 +606,7 @@ static void update_output_parameters(int selectedDevice, const PaDeviceInfo *dev
|
||||
if (deviceInfo)
|
||||
{
|
||||
double aLatency = deviceInfo->defaultLowOutputLatency;
|
||||
double aCoeff = round(0.100 / aLatency);
|
||||
// double aCoeff = round(0.100 / aLatency);
|
||||
// myOutputParameters.suggestedLatency = aCoeff * aLatency; // to avoid glitches ?
|
||||
myOutputParameters.suggestedLatency = aLatency; // for faster response ?
|
||||
SHOW("Device=%d, myOutputParameters.suggestedLatency=%f, aCoeff=%f\n",
|
||||
|
||||
Reference in New Issue
Block a user