mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-30 14:22:29 +00:00
Merge branch 'master' into android
This commit is contained in:
+23
-5
@@ -745,6 +745,7 @@ static void CompileReport(void)
|
||||
REF_HASH_TAB **list;
|
||||
const char *data_path;
|
||||
int prev_table;
|
||||
int procedure_num;
|
||||
int prev_mnemonic;
|
||||
|
||||
if(f_report == NULL)
|
||||
@@ -802,7 +803,17 @@ static void CompileReport(void)
|
||||
j++;
|
||||
}
|
||||
|
||||
fprintf(f_report," [%s] %s",WordToString(prev_mnemonic = list[ix]->ph_mnemonic), phoneme_tab_list2[prev_table = list[ix]->ph_table].name);
|
||||
prev_mnemonic = list[ix]->ph_mnemonic;
|
||||
if((prev_mnemonic >> 24) == 'P')
|
||||
{
|
||||
// a procedure, not a phoneme
|
||||
procedure_num = atoi(WordToString(prev_mnemonic));
|
||||
fprintf(f_report," %s %s", phoneme_tab_list2[prev_table = list[ix]->ph_table].name, proc_names[procedure_num]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(f_report," [%s] %s",WordToString(prev_mnemonic), phoneme_tab_list2[prev_table = list[ix]->ph_table].name);
|
||||
}
|
||||
fputc('\n',f_report);
|
||||
}
|
||||
|
||||
@@ -1856,7 +1867,7 @@ static int LoadWavefile(FILE *f, const char *fname)
|
||||
}
|
||||
|
||||
sprintf(command,"sox \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp);
|
||||
if(system(command) < 0)
|
||||
if(system(command) != 0)
|
||||
{
|
||||
failed = 1;
|
||||
}
|
||||
@@ -2761,6 +2772,8 @@ int CompilePhoneme(int compile_phoneme)
|
||||
}
|
||||
strcpy(proc_names[n_procs], item_string);
|
||||
phoneme_out = &phoneme_out2;
|
||||
sprintf(number_buf,"%.3dP", n_procs);
|
||||
phoneme_out->mnemonic = StringToWord(number_buf);
|
||||
}
|
||||
|
||||
phoneme_out->code = phcode;
|
||||
@@ -3498,10 +3511,11 @@ static void CompilePhonemeData2(const char *source)
|
||||
make_envs();
|
||||
#endif
|
||||
|
||||
wxLogStatus(_T("Compiling phoneme data: ")+wxString(path_source,wxConvLocal));
|
||||
n_envelopes = 0;
|
||||
error_count = 0;
|
||||
resample_count = 0;
|
||||
memset(markers_used,0,sizeof(markers_used));
|
||||
memset(markers_used,0,sizeof(markers_used));
|
||||
|
||||
f_errors = stderr;
|
||||
|
||||
@@ -3668,7 +3682,7 @@ fprintf(f_errors,"\nRefs %d, Reused %d\n",count_references,duplicate_references
|
||||
|
||||
if(error_count > 0)
|
||||
{
|
||||
report += _T(" See file: 'phsource/error_log'.");
|
||||
report += _T(" See file: '")+wxString(path_source,wxConvLocal)+_T("phsource/error_log'.");
|
||||
wxLogError(report);
|
||||
}
|
||||
wxLogStatus(report + report_dict);
|
||||
@@ -4138,7 +4152,11 @@ void CompilePhonemeData()
|
||||
void CompileSampleRate()
|
||||
{
|
||||
long value;
|
||||
value = wxGetNumberFromUser(_T("Compile phoneme data with a specified sample rate"), _T("Sample rate"), _T("Resample (needs sox)"), 22050, 5000, 48000);
|
||||
#ifndef PLATFORM_POSIX
|
||||
wxLogError(_T("Change Sample Rate needs the 'sox' program. It probably doesn't work on Windows"));
|
||||
#endif
|
||||
|
||||
value = wxGetNumberFromUser(_T("Compile phoneme data with a specified sample rate"), _T("Sample rate"), _T("Resample (needs 'sox' program)"), 22050, 5000, 48000);
|
||||
|
||||
if(value > 1000)
|
||||
{
|
||||
|
||||
+2
-2
@@ -3182,7 +3182,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
continue;
|
||||
}
|
||||
|
||||
if((dictionary_flags2 & FLAG_ATEND) && (word_end < tr->clause_end))
|
||||
if((dictionary_flags2 & FLAG_ATEND) && (word_end < translator->clause_end))
|
||||
{
|
||||
// only use this pronunciation if it's the last word of the clause
|
||||
continue;
|
||||
@@ -3194,7 +3194,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor
|
||||
continue;
|
||||
}
|
||||
|
||||
if((dictionary_flags2 & FLAG_SENTENCE) && !(tr->clause_terminator & CLAUSE_BIT_SENTENCE))
|
||||
if((dictionary_flags2 & FLAG_SENTENCE) && !(translator->clause_terminator & CLAUSE_BIT_SENTENCE))
|
||||
{
|
||||
// only uis this clause is a sentence , i.e. terminator is {. ? !} not {, : :}
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -91,8 +91,8 @@ wxMenuBar *MakeMenu(int type, const char *dict_name)
|
||||
data_menu = new wxMenu;
|
||||
data_menu->Append(MENU_COMPILE_DICT, _("Compile &dictionary"));
|
||||
data_menu->Append(MENU_COMPILE_DICT_DEBUG, _("Compile dictionary (debu&g)"));
|
||||
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data"));
|
||||
data_menu->Append(MENU_COMPILE_PH2, _("Change sample &rate"));
|
||||
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data 22050Hz"));
|
||||
data_menu->Append(MENU_COMPILE_PH2, _("Compile at sample &rate"));
|
||||
data_menu->AppendSeparator();
|
||||
data_menu->Append(MENU_COMPILE_MBROLA, _("Compile &mbrola phonemes list..."));
|
||||
data_menu->Append(MENU_COMPILE_INTONATION, _("Compile &intonation data"));
|
||||
|
||||
+46
-12
@@ -122,6 +122,8 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
int regression;
|
||||
int end_sourceix;
|
||||
int alternative;
|
||||
int delete_count;
|
||||
int word_start;
|
||||
PHONEME_DATA phdata;
|
||||
|
||||
int n_ph_list3;
|
||||
@@ -166,18 +168,40 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
}
|
||||
|
||||
// look for switch of phoneme tables
|
||||
delete_count = 0;
|
||||
current_phoneme_tab = tr->phoneme_tab_ix;
|
||||
for(j = 0; j < n_ph_list2; j++)
|
||||
{
|
||||
if(plist2[j].phcode == phonSWITCH)
|
||||
{
|
||||
current_phoneme_tab = plist2[j].tone_ph;
|
||||
}
|
||||
if(current_phoneme_tab != tr->phoneme_tab_ix)
|
||||
{
|
||||
plist2[j].synthflags |= SFLAG_SWITCHED_LANG;
|
||||
}
|
||||
|
||||
if(delete_count > 0)
|
||||
{
|
||||
memcpy(&plist2[j-delete_count], &plist2[j], sizeof(plist2[0]));
|
||||
}
|
||||
|
||||
if(plist2[j].phcode == phonSWITCH)
|
||||
{
|
||||
if((!(plist2[j].synthflags & SFLAG_EMBEDDED)) && (
|
||||
(plist2[j].tone_ph == current_phoneme_tab) ||
|
||||
(plist2[j+1].phcode == phonSWITCH) ||
|
||||
((plist2[j+1].phcode == phonPAUSE) && (plist2[j+2].phcode == phonSWITCH))
|
||||
))
|
||||
{
|
||||
// delete this phonSWITCH if it's switching to the current phoneme table, or
|
||||
// delete this phonSWITCH if its followed by another phonSWITCH
|
||||
delete_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_phoneme_tab = plist2[j].tone_ph;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
n_ph_list2 -= delete_count;
|
||||
|
||||
if((regression = tr->langopts.param[LOPT_REGRESSIVE_VOICING]) != 0)
|
||||
{
|
||||
@@ -311,23 +335,39 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
// transfer all the phonemes of the clause into phoneme_list
|
||||
ph = phoneme_tab[phonPAUSE];
|
||||
ph_list3[0].ph = ph;
|
||||
word_start = 1;
|
||||
|
||||
for(j=0; insert_ph || ((j < n_ph_list3) && (ix < N_PHONEME_LIST-3)); j++)
|
||||
{
|
||||
plist3 = &ph_list3[j];
|
||||
|
||||
if(plist3->sourceix != 0)
|
||||
word_start = j;
|
||||
|
||||
if(insert_ph != 0)
|
||||
{
|
||||
// we have a (linking) phoneme which we need to insert here
|
||||
next = phoneme_tab[plist3->phcode]; // this phoneme, i.e. after the insert
|
||||
|
||||
// re-use the previous entry for the inserted phoneme.
|
||||
// That's OK because we don't look backwards from plist3 *** but CountVowelPosiion() and isAfterStress does !!!
|
||||
// That's OK because we don't look backwards from plist3 *** but CountVowelPosition() and isAfterStress does !!!
|
||||
j--;
|
||||
plist3 = plist3_inserted = &ph_list3[j];
|
||||
if(j > 0)
|
||||
{
|
||||
memcpy(&plist3[-1], &plist3[0], sizeof(*plist3));
|
||||
// move all previous phonemes in the word back one place
|
||||
int k;
|
||||
if(word_start > 0)
|
||||
{
|
||||
k = word_start;
|
||||
word_start--;
|
||||
}
|
||||
else
|
||||
{
|
||||
k = 2; // No more space, don't loose the start of word mark at ph_list2[word_start]
|
||||
}
|
||||
for(; k<=j; k++)
|
||||
memcpy(&ph_list3[k-1], &ph_list3[k], sizeof(*plist3));
|
||||
}
|
||||
memset(&plist3[0], 0, sizeof(*plist3));
|
||||
plist3->phcode = insert_ph;
|
||||
@@ -343,12 +383,6 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
|
||||
if(plist3->phcode == phonSWITCH)
|
||||
{
|
||||
if(!(plist3->synthflags & SFLAG_EMBEDDED)) // ?? phonSWITCH can't have SFLAG_EMBEDDED ??
|
||||
{
|
||||
if((plist3[1].phcode == phonSWITCH) || ((plist3[1].type == phPAUSE) && (plist3[2].phcode == phonSWITCH)))
|
||||
continue; // next phoneme is also a phonSWITCH, so ignore
|
||||
}
|
||||
|
||||
// change phoneme table
|
||||
SelectPhonemeTable(plist3->tone_ph);
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.48 13.Mar.13";
|
||||
const char *version_string = "1.46.53 16.Mar.13";
|
||||
const int version_phdata = 0x014640;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ const char *WordToString(unsigned int word)
|
||||
int ix;
|
||||
static char buf[5];
|
||||
|
||||
for(ix=0; ix<3; ix++)
|
||||
for(ix=0; ix<4; ix++)
|
||||
buf[ix] = word >> (ix*8);
|
||||
buf[4] = 0;
|
||||
return(buf);
|
||||
|
||||
@@ -455,6 +455,7 @@ Translator *SelectTranslator(const char *name)
|
||||
static const short stress_lengths_sk[8] = {190,190, 210,210, 0,0, 210,210};
|
||||
|
||||
static const short stress_lengths_ta[8] = {200, 200, 210, 210, 0, 0, 230, 230};
|
||||
static const short stress_lengths_ta2[8] = {230, 230, 240, 240, 0, 0, 260, 260};
|
||||
static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
|
||||
|
||||
// convert name string into a word of up to 4 characters, for the switch()
|
||||
@@ -731,6 +732,7 @@ Translator *SelectTranslator(const char *name)
|
||||
if(name2 == L('a','n'))
|
||||
{
|
||||
tr->langopts.stress_flags = S_FINAL_SPANISH | S_FINAL_DIM_ONLY | S_FINAL_NO_2;
|
||||
tr->langopts.numbers2 = 0;
|
||||
}
|
||||
else
|
||||
if(name2 == L_pap)
|
||||
@@ -1423,7 +1425,7 @@ SetLengthMods(tr,3); // all equal
|
||||
case L('m','r'): // Marathi
|
||||
case L('t','e'): // Telugu
|
||||
{
|
||||
SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
|
||||
SetupTranslator(tr,stress_lengths_ta2, stress_amps_ta);
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
|
||||
tr->langopts.stress_rule = STRESSPOSN_1L;
|
||||
@@ -1433,9 +1435,12 @@ SetLengthMods(tr,3); // all equal
|
||||
|
||||
if(name2 == L('t','a'))
|
||||
{
|
||||
SetupTranslator(tr,stress_lengths_ta, NULL);
|
||||
tr->letter_bits_offset = OFFSET_TAMIL;
|
||||
tr->langopts.numbers = NUM_OMIT_1_THOUSAND ;
|
||||
tr->langopts.param[LOPT_WORD_MERGE] = 1; // don't break vowels betwen words
|
||||
}
|
||||
else
|
||||
if(name2 == L('m','r'))
|
||||
{
|
||||
tr->letter_bits_offset = OFFSET_DEVANAGARI;
|
||||
@@ -1458,9 +1463,8 @@ SetLengthMods(tr,3); // all equal
|
||||
tr->letter_bits_offset = OFFSET_TELUGU;
|
||||
tr->langopts.numbers = 0x1;
|
||||
}
|
||||
tr->langopts.param[LOPT_WORD_MERGE] = 1; // don't break vowels betwen words
|
||||
SetIndicLetters(tr); // call this after setting OFFSET_
|
||||
SetLetterBitsRange(tr,LETTERGP_B,0x4e,0x4e); // chillu-virama (unofficial)
|
||||
SetLetterBitsRange(tr,LETTERGP_B,0x4e,0x4e); // chillu-virama (unofficial)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+12
-3
@@ -846,7 +846,7 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
char prefix_chars[0x3f + 2];
|
||||
int found=0;
|
||||
int end_flags;
|
||||
char c_temp; // save a character byte while we temporarily replace it with space
|
||||
int c_temp; // save a character byte while we temporarily replace it with space
|
||||
int first_char;
|
||||
int last_char = 0;
|
||||
int add_plural_suffix = 0;
|
||||
@@ -916,7 +916,9 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
if((word_length == 1) && (wflags & FLAG_TRANSLATOR2))
|
||||
{
|
||||
// retranslating a 1-character word using a different language, say its name
|
||||
spell_word = 1;
|
||||
utf8_in(&c_temp, wordx+1); // the next character
|
||||
if(!IsAlpha(c_temp) || (AlphabetFromChar(last_char) != AlphabetFromChar(c_temp)))
|
||||
spell_word = 1;
|
||||
}
|
||||
|
||||
if(option_sayas == SAYAS_KEY)
|
||||
@@ -1077,10 +1079,16 @@ int TranslateWord(Translator *tr, char *word_start, int next_pause, WORD_TAB *wt
|
||||
{
|
||||
if(word_length > 1)
|
||||
return(FLAG_SPELLWORD); // a mixture of languages, retranslate as individual letters, separated by spaces
|
||||
if(phonemes[0] == phonSWITCH)
|
||||
{
|
||||
// problem with espeak -vbg "b.c.d.e.f"
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
strcpy(word_phonemes, phonemes);
|
||||
return(dictionary_flags[0] & FLAG_SKIPWORDS); // ??
|
||||
if(wflags & FLAG_TRANSLATOR2)
|
||||
return(0);
|
||||
return(dictionary_flags[0] & FLAG_SKIPWORDS); // for "b.c.d"
|
||||
}
|
||||
else if(found == 0)
|
||||
{
|
||||
@@ -1936,6 +1944,7 @@ static int TranslateWord2(Translator *tr, char *word, WORD_TAB *wtab, int pre_pa
|
||||
if(ok)
|
||||
{
|
||||
*p2 = '-'; // replace next space by hyphen
|
||||
wtab[0].flags &= ~FLAG_ALL_UPPER; // prevent it being considered an abbreviation
|
||||
flags = TranslateWord(translator, word, next_pause, wtab, NULL); // translate the combined word
|
||||
if((sylimit > 0) && (CountSyllables(p) > (sylimit & 0x1f)))
|
||||
{
|
||||
|
||||
+1
-1
@@ -587,7 +587,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
static const char *voices_asia =
|
||||
"fa fa-pin hi hy hy-west id ka kn ku ml ne pa ta tr vi vi-hue zh zh-yue ";
|
||||
static const char *voices_europe =
|
||||
"bg bs ca cs cy da el es et fi fr-be hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
"an bg bs ca cs cy da el es et fi fr-be hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
|
||||
|
||||
strncpy0(voicename, vname, sizeof(voicename));
|
||||
|
||||
Reference in New Issue
Block a user