mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 21:39:47 +00:00
[1.46.24]
Changes to: pt, tt, es Added new language data: ko (Korean) Phoneme definitions, added new condition: prevVowel() git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@289 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+57
-44
@@ -90,17 +90,18 @@ static keywtab_t k_conditions[] = {
|
||||
{"AND", 0, k_AND},
|
||||
{"OR", 0, k_OR},
|
||||
{"THEN", 0, k_THEN},
|
||||
{"prevPh", tWHICH_PHONEME, 0x000},
|
||||
{"prevPhW", tWHICH_PHONEME, 0x500},
|
||||
{"thisPh", tWHICH_PHONEME, 0x100},
|
||||
{"nextPh", tWHICH_PHONEME, 0x200},
|
||||
{"next2Ph", tWHICH_PHONEME, 0x300},
|
||||
{"nextPhW", tWHICH_PHONEME, 0x400},
|
||||
{"nextVowel",tWHICH_PHONEME, 0x600},
|
||||
// {"next2PhW", tWHICH_PHONEME, 0x700},
|
||||
{"prevPh", tWHICH_PHONEME, 0},
|
||||
{"prevPhW", tWHICH_PHONEME, 5},
|
||||
{"thisPh", tWHICH_PHONEME, 1},
|
||||
{"nextPh", tWHICH_PHONEME, 2},
|
||||
{"next2Ph", tWHICH_PHONEME, 3},
|
||||
{"nextPhW", tWHICH_PHONEME, 4},
|
||||
{"next2PhW", tWHICH_PHONEME, 6},
|
||||
{"nextVowel",tWHICH_PHONEME, 7},
|
||||
{"prevVowel",tWHICH_PHONEME, 8},
|
||||
// {"next2PhW", tWHICH_PHONEME, 0x800},
|
||||
|
||||
// {"numVowels", tTEST, 0x000},
|
||||
// {"afterStress", tTEST, 0x000},
|
||||
|
||||
{"PreVoicing", tTEST, 0xf01},
|
||||
{"KlattSynth", tTEST, 0xf02},
|
||||
@@ -605,7 +606,7 @@ return;
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
address = ((instn & 0xf) << 16) + *pc++;
|
||||
address = ((instn & 0xf) << 16) + *pc++;
|
||||
fprintf(f_out, " %d %.5x",(instn >> 4) & 0xff,address*4);
|
||||
break;
|
||||
}
|
||||
@@ -770,7 +771,7 @@ static void CompileReport(void)
|
||||
}
|
||||
n = ix;
|
||||
qsort((void *)list,n,sizeof(REF_HASH_TAB *),(int (*)(const void *,const void *))ref_sorter);
|
||||
|
||||
|
||||
data_path = "";
|
||||
prev_mnemonic = 0;
|
||||
prev_table = 0;
|
||||
@@ -1197,7 +1198,7 @@ static int LookupPhoneme(const char *string, int control)
|
||||
|
||||
// don't use phoneme number 0, reserved for string terminator
|
||||
start = 1;
|
||||
|
||||
|
||||
if(control==2)
|
||||
start = 8; // don't look for control and stress phonemes (allows these characters to be
|
||||
// used for other purposes)
|
||||
@@ -1267,12 +1268,12 @@ static int NextItem(int type)
|
||||
int sign;
|
||||
char *p;
|
||||
keywtab_t *pk;
|
||||
|
||||
|
||||
item_type = -1;
|
||||
|
||||
f_in_displ = ftell(f_in);
|
||||
f_in_linenum = linenum;
|
||||
|
||||
|
||||
while(!feof(f_in))
|
||||
{
|
||||
c = get_char();
|
||||
@@ -1592,7 +1593,7 @@ int LoadSpect(const char *path, int control)
|
||||
|
||||
wxString filename = path_phsource + path_sep + wxString(path,wxConvLocal);
|
||||
wxFileInputStream stream(filename);
|
||||
|
||||
|
||||
if(stream.Ok() == FALSE)
|
||||
{
|
||||
error("Failed to open: '%s'",path);
|
||||
@@ -1616,7 +1617,7 @@ int LoadSpect(const char *path, int control)
|
||||
seq_out.sqflags=0;
|
||||
seq_out.length_total=0;
|
||||
|
||||
total = 0;
|
||||
total = 0;
|
||||
for(frame=0; frame < spectseq->numframes; frame++)
|
||||
{
|
||||
|
||||
@@ -1650,7 +1651,7 @@ for(ix=0; ix<8; ix++)
|
||||
seq_out.n_frames++;
|
||||
if(frame > 0)
|
||||
total += spectseq->frames[frame-1]->length;
|
||||
}
|
||||
}
|
||||
}
|
||||
seq_out.length_total = int(total);
|
||||
|
||||
@@ -1665,7 +1666,7 @@ for(ix=0; ix<8; ix++)
|
||||
for(frame=0; frame < spectseq->numframes; frame++)
|
||||
{
|
||||
fr = spectseq->frames[frame];
|
||||
|
||||
|
||||
if(fr->keyframe)
|
||||
{
|
||||
if(klatt_flag)
|
||||
@@ -1756,7 +1757,7 @@ for(ix=0; ix<8; ix++)
|
||||
n_frames++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(klatt_flag)
|
||||
{
|
||||
seqk_out.n_frames = seq_out.n_frames;
|
||||
@@ -1799,7 +1800,7 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
fseek(f,24,SEEK_SET);
|
||||
sr1 = Read4Bytes(f);
|
||||
sr2 = Read4Bytes(f);
|
||||
fseek(f,40,SEEK_SET);
|
||||
fseek(f,40,SEEK_SET);
|
||||
|
||||
if((sr1 != samplerate_native) || (sr2 != sr1*2))
|
||||
{
|
||||
@@ -1828,7 +1829,7 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
f = fopen(fname_temp,"rb");
|
||||
if(f == NULL)
|
||||
{
|
||||
@@ -2078,7 +2079,7 @@ static int LoadDataFile(const char *path, int control)
|
||||
if(addr == 0)
|
||||
{
|
||||
sprintf(buf,"%s%s",path_source,path);
|
||||
|
||||
|
||||
if((f = fopen(buf,"rb")) == NULL)
|
||||
{
|
||||
sprintf(buf,"%s%s.wav",path_source,path);
|
||||
@@ -2091,7 +2092,7 @@ static int LoadDataFile(const char *path, int control)
|
||||
|
||||
id = Read4Bytes(f);
|
||||
rewind(f);
|
||||
|
||||
|
||||
if(id == 0x43455053)
|
||||
{
|
||||
addr = LoadSpect(path, control);
|
||||
@@ -2121,7 +2122,7 @@ static int LoadDataFile(const char *path, int control)
|
||||
addr = -1;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
|
||||
if(addr > 0)
|
||||
{
|
||||
fprintf(f_phcontents,"%c 0x%.5x %s\n",type_code,addr & 0x7fffff,path);
|
||||
@@ -2188,7 +2189,7 @@ static int CompileToneSpec(void)
|
||||
*prog_out++ = i_AMPENV + ((amp_env >> 16) & 0xf);
|
||||
*prog_out++ = amp_env;
|
||||
}
|
||||
|
||||
|
||||
return(0);
|
||||
} // end of CompileToneSpec
|
||||
|
||||
@@ -2217,7 +2218,7 @@ int CompileSound(int keyword, int isvowel)
|
||||
{
|
||||
value = -128;
|
||||
error("Parameter < -128",NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2256,6 +2257,7 @@ int CompileIf(int elif)
|
||||
int key;
|
||||
int finish = 0;
|
||||
int word = 0;
|
||||
int word2 = 0;
|
||||
int data;
|
||||
int bitmap;
|
||||
int brackets;
|
||||
@@ -2274,10 +2276,18 @@ int CompileIf(int elif)
|
||||
|
||||
if((key = NextItem(tCONDITION)) < 0)
|
||||
error("Expected a condition, not '%s'",item_string);
|
||||
|
||||
|
||||
if(item_type == tWHICH_PHONEME)
|
||||
{
|
||||
// prevPh(), thisPh(), nextPh(), next2Ph()
|
||||
// prevPh(), thisPh(), nextPh(), next2Ph() etc
|
||||
if(key >= 6)
|
||||
{
|
||||
// put the 'which' code in the next instruction
|
||||
word2 = key;
|
||||
key = 6;
|
||||
}
|
||||
key = key << 8;
|
||||
|
||||
data = NextItemBrackets(tPROPERTIES,0);
|
||||
if(data >= 0)
|
||||
{
|
||||
@@ -2320,6 +2330,9 @@ int CompileIf(int elif)
|
||||
prog_last_if = prog_out;
|
||||
*prog_out++ = word | i_CONDITION;
|
||||
|
||||
if(word2 != 0)
|
||||
*prog_out++ = word2;
|
||||
|
||||
// expect AND, OR, THEN
|
||||
switch(NextItem(tCONDITION))
|
||||
{
|
||||
@@ -2416,7 +2429,7 @@ int CompileElse(void)
|
||||
{
|
||||
ref = prog_out;
|
||||
*prog_out++ = 0;
|
||||
|
||||
|
||||
if((p = if_stack[if_level].p_else) != NULL)
|
||||
{
|
||||
*ref = ref - p; // backwards offset to the previous else
|
||||
@@ -2461,14 +2474,14 @@ int CompileEndif(void)
|
||||
do
|
||||
{
|
||||
chain = *p; // a chain of previous else links
|
||||
|
||||
|
||||
offset = prog_out - p;
|
||||
if(offset > MAX_JUMP)
|
||||
{
|
||||
error("IF block is too long",NULL);
|
||||
}
|
||||
*p = i_JUMP + offset;
|
||||
|
||||
|
||||
p -= chain;
|
||||
} while (chain > 0);
|
||||
}
|
||||
@@ -2489,7 +2502,7 @@ static int CompileSwitch(int type)
|
||||
// check the instructions in the Switch
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// count_VowelStart = 0;
|
||||
// count_VowelEnding = 0;
|
||||
|
||||
@@ -2664,7 +2677,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
phoneme_flags = 0;
|
||||
place_articulation = 0;
|
||||
|
||||
NextItem(tSTRING);
|
||||
NextItem(tSTRING);
|
||||
if(compile_phoneme)
|
||||
{
|
||||
phcode = LookupPhoneme(item_string,1); // declare phoneme if not already there
|
||||
@@ -2825,7 +2838,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
phcode = LookupPhoneme(item_string,1);
|
||||
phoneme_out->start_type = phcode;
|
||||
break;
|
||||
|
||||
|
||||
case kENDTYPE:
|
||||
phcode = NextItem(tPHONEMEMNEM);
|
||||
if(phcode == -1)
|
||||
@@ -2882,7 +2895,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
case kSWITCH_PREVVOWEL:
|
||||
endphoneme = CompileSwitch(1);
|
||||
break;
|
||||
|
||||
|
||||
case kSWITCH_NEXTVOWEL:
|
||||
endphoneme = CompileSwitch(2);
|
||||
break;
|
||||
@@ -2908,7 +2921,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
DecThenCount();
|
||||
endphoneme = CompileSound(keyword,0);
|
||||
break;
|
||||
|
||||
|
||||
case kVOWELIN:
|
||||
DecThenCount();
|
||||
endphoneme = CompileVowelTransition(1);
|
||||
@@ -2968,7 +2981,7 @@ int CompilePhoneme(int compile_phoneme)
|
||||
}
|
||||
phoneme_out->phflags = place_articulation << 16;
|
||||
phoneme_out->phflags |= phoneme_flags;
|
||||
|
||||
|
||||
if(phoneme_out->phflags & phVOICED)
|
||||
{
|
||||
if(phoneme_out->type == phSTOP)
|
||||
@@ -2977,15 +2990,15 @@ int CompilePhoneme(int compile_phoneme)
|
||||
if(phoneme_out->type == phFRICATIVE)
|
||||
phoneme_out->type = phVFRICATIVE;
|
||||
}
|
||||
|
||||
|
||||
if(phoneme_out->std_length == 0)
|
||||
{
|
||||
if(phoneme_out->type == phVOWEL)
|
||||
phoneme_out->std_length = 180/2; // default length for vowel
|
||||
}
|
||||
|
||||
|
||||
phoneme_out->phflags |= phLOCAL; //declared in this phoneme table
|
||||
|
||||
|
||||
if(phoneme_out->type == phDELETED)
|
||||
{
|
||||
phoneme_out->mnemonic = 0x01; // will not be recognised
|
||||
@@ -3334,7 +3347,7 @@ static void CompilePhonemeFiles()
|
||||
stack[stack_ix].linenum = linenum;
|
||||
strcpy(stack[stack_ix].fname,current_fname);
|
||||
stack[stack_ix++].file = f_in;
|
||||
|
||||
|
||||
f_in = f;
|
||||
strncpy0(current_fname,item_string,sizeof(current_fname));
|
||||
linenum = 1;
|
||||
@@ -3382,7 +3395,7 @@ static void CompilePhonemeData2(const char *source)
|
||||
wxString report_dict;
|
||||
|
||||
#ifdef MAKE_ENVELOPES
|
||||
make_envs();
|
||||
make_envs();
|
||||
#endif
|
||||
|
||||
n_envelopes = 0;
|
||||
@@ -3525,7 +3538,7 @@ fprintf(f_errors,"\nRefs %d, Reused %d\n",count_references,duplicate_references
|
||||
{
|
||||
strncpy0(fname,(report+report_dict).mb_str(wxConvLocal),sizeof(fname));
|
||||
fprintf(stderr,"%s\n",fname);
|
||||
|
||||
|
||||
}
|
||||
} // end of CompilePhonemeData
|
||||
|
||||
@@ -3605,7 +3618,7 @@ void CompileMbrola()
|
||||
wxLogError(_T("Can't write to: ")+wxString(buf,wxConvLocal));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
data[count].name = 0; // list terminator
|
||||
Write4Bytes(f_out, mbrola_ctrl);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user