mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 21:39:47 +00:00
Merge branch 'master' into android
Conflicts: platforms/windows/make_espeakedit.iss
This commit is contained in:
+78
-19
@@ -110,6 +110,7 @@ enum {
|
||||
V_FAST,
|
||||
V_SPEED,
|
||||
V_DICTMIN,
|
||||
V_ALPHABET2,
|
||||
|
||||
// these need a phoneme table to have been specified
|
||||
V_REPLACE,
|
||||
@@ -161,6 +162,7 @@ static MNEM_TAB keyword_tab[] = {
|
||||
{"fast_test2", V_FAST},
|
||||
{"speed", V_SPEED},
|
||||
{"dict_min", V_DICTMIN},
|
||||
{"alphabet2", V_ALPHABET2},
|
||||
|
||||
// these just set a value in langopts.param[]
|
||||
{"l_dieresis", 0x100+LOPT_DIERESES},
|
||||
@@ -396,10 +398,10 @@ void VoiceReset(int tone_only)
|
||||
// Set voice to the default values
|
||||
|
||||
int pk;
|
||||
// static unsigned char default_heights[N_PEAKS] = {140,128,120,110,90,90,128,128,128}; // changed for v.1.47
|
||||
// static unsigned char default_widths[N_PEAKS] = {128,128,128,160,171,171,128,128,128};
|
||||
static unsigned char default_heights[N_PEAKS] = {128,128,120,120,110,110,128,128,128}; // previous version
|
||||
static unsigned char default_heights[N_PEAKS] = {130,128,120,116,100,100,128,128,128}; // changed for v.1.47
|
||||
static unsigned char default_widths[N_PEAKS] = {140,128,128,160,171,171,128,128,128};
|
||||
// static unsigned char default_heights[N_PEAKS] = {128,128,120,120,110,110,128,128,128}; // previous version
|
||||
// static unsigned char default_widths[N_PEAKS] = {128,128,128,160,171,171,128,128,128};
|
||||
|
||||
static int breath_widths[N_PEAKS] = {0,200,200,400,400,400,600,600,600};
|
||||
|
||||
@@ -420,7 +422,7 @@ void VoiceReset(int tone_only)
|
||||
voice->n_harmonic_peaks = 5;
|
||||
voice->peak_shape = 0;
|
||||
voice->voicing = 64;
|
||||
voice->consonant_amp = 85; // change to 85 for v.1.47 was 100
|
||||
voice->consonant_amp = 90; // change to 85 for v.1.47 was 100
|
||||
voice->consonant_ampv = 100;
|
||||
voice->samplerate = samplerate_native;
|
||||
memset(voice->klattv,0,sizeof(voice->klattv));
|
||||
@@ -448,7 +450,6 @@ void VoiceReset(int tone_only)
|
||||
// adjust formant smoothing depending on sample rate
|
||||
formant_rate[pk] = (formant_rate_22050[pk] * 22050)/samplerate;
|
||||
}
|
||||
voice->height[2] = 240; // reduce F2 slightly
|
||||
|
||||
// This table provides the opportunity for tone control.
|
||||
// Adjustment of harmonic amplitudes, steps of 8Hz
|
||||
@@ -532,6 +533,21 @@ static int Read8Numbers(char *data_in,int *data)
|
||||
}
|
||||
|
||||
|
||||
static unsigned int StringToWord2(const char *string)
|
||||
{//======================================================
|
||||
// Convert a language name string to a word such as L('e','n')
|
||||
int ix;
|
||||
int c;
|
||||
unsigned int value = 0;
|
||||
|
||||
for(ix=0; (ix<4) & ((c = string[ix]) != 0); ix++)
|
||||
{
|
||||
value = (value << 8) | (c & 0xff);
|
||||
}
|
||||
return(value);
|
||||
}
|
||||
|
||||
|
||||
voice_t *LoadVoice(const char *vname, int control)
|
||||
{//===============================================
|
||||
// control, bit 0 1= no_default
|
||||
@@ -573,6 +589,7 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
int stress_lengths[8];
|
||||
int stress_add[8];
|
||||
char names[8][40];
|
||||
char name1[40];
|
||||
char name2[80];
|
||||
const char *voice_dir;
|
||||
|
||||
@@ -583,11 +600,11 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
static char voice_name[40]; // voice name for current_voice_selected
|
||||
static char voice_languages[100]; // list of languages and priorities for current_voice_selected
|
||||
|
||||
// which directory to look for a named voice
|
||||
// which directory to look for a named voice. List of voice names, must end in a space.
|
||||
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 ";
|
||||
"fa fa-pin hi hy hy-west id ka kn ku ml ms ne pa ta tr vi vi-hue zh zh-yue ";
|
||||
static const char *voices_europe =
|
||||
"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 ";
|
||||
"an bg bs ca cs cy da de el en en-us es et fi fr fr-be ga hr hu is it lt lv mk nl no pl pt-pt ro ru sk sq sr sv ";
|
||||
|
||||
|
||||
strncpy0(voicename, vname, sizeof(voicename));
|
||||
@@ -962,12 +979,10 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
case V_MBROLA:
|
||||
{
|
||||
int srate = 16000;
|
||||
char name[40];
|
||||
char phtrans[40];
|
||||
|
||||
phtrans[0] = 0;
|
||||
sscanf(p,"%s %s %d",name,phtrans,&srate);
|
||||
if(LoadMbrolaTable(name,phtrans,srate) != EE_OK)
|
||||
name2[0] = 0;
|
||||
sscanf(p,"%s %s %d",name1,name2,&srate);
|
||||
if(LoadMbrolaTable(name1,name2,srate) != EE_OK)
|
||||
{
|
||||
fprintf(stderr,"mbrola voice not found\n");
|
||||
}
|
||||
@@ -990,6 +1005,28 @@ voice_t *LoadVoice(const char *vname, int control)
|
||||
sscanf(p,"%d",&dict_min);
|
||||
break;
|
||||
|
||||
case V_ALPHABET2:
|
||||
{
|
||||
ALPHABET *alphabet;
|
||||
name1[0] = name2[0] = 0;
|
||||
sscanf(p, "%s %s", name1, name2);
|
||||
|
||||
if(strcmp(name1, "latin") == 0)
|
||||
{
|
||||
strncpy0(langopts->ascii_language,name2,sizeof(langopts->ascii_language));
|
||||
}
|
||||
else if((alphabet = AlphabetFromName(name1)) != 0)
|
||||
{
|
||||
langopts->alt_alphabet = alphabet->offset;
|
||||
langopts->alt_alphabet_lang = StringToWord2(name2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"alphabet name '%s' not found\n", name1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if((key & 0xff00) == 0x100)
|
||||
{
|
||||
@@ -1098,7 +1135,7 @@ static char *ExtractVoiceVariantName(char *vname, int variant_num, int add_dir)
|
||||
// The voice name has a +variant suffix
|
||||
variant_num = 0;
|
||||
*p++ = 0; // delete the suffix from the voice name
|
||||
if(isdigit(*p))
|
||||
if(IsDigit09(*p))
|
||||
{
|
||||
variant_num = atoi(p); // variant number
|
||||
}
|
||||
@@ -1191,10 +1228,10 @@ static int ScoreVoice(espeak_VOICE *voice_spec, const char *spec_language, int s
|
||||
|
||||
p = voice->languages; // list of languages+dialects for which this voice is suitable
|
||||
|
||||
if(strcmp(spec_language,"mbrola")==0)
|
||||
if(spec_n_parts < 0)
|
||||
{
|
||||
// only list mbrola voices
|
||||
if(memcmp(voice->identifier,"mb/",3) == 0)
|
||||
// match on the subdirectory
|
||||
if(memcmp(voice->identifier, spec_language, spec_lang_len) == 0)
|
||||
return(100);
|
||||
return(0);
|
||||
}
|
||||
@@ -1327,6 +1364,7 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
int lang_len=0;
|
||||
espeak_VOICE *vp;
|
||||
char language[80];
|
||||
char buf[sizeof(path_home)+80];
|
||||
|
||||
// count number of parts in the specified language
|
||||
if((voice_select->languages != NULL) && (voice_select->languages[0] != 0))
|
||||
@@ -1339,6 +1377,26 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int
|
||||
n_parts++;
|
||||
}
|
||||
}
|
||||
|
||||
if((n_parts == 1) && (control & 1))
|
||||
{
|
||||
if(strcmp(language, "mbrola") == 0)
|
||||
{
|
||||
language[2] = 0; // truncate to "mb"
|
||||
lang_len = 2;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/voices/%s", path_home, language);
|
||||
if(GetFileLength(buf) == -2)
|
||||
{
|
||||
// A subdirectory name has been specified. List all the voices in that subdirectory
|
||||
language[lang_len++] = PATHSEP;
|
||||
language[lang_len] = 0;
|
||||
n_parts = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// select those voices which match the specified language
|
||||
nv = 0;
|
||||
for(ix=0; ix<n_voices_list; ix++)
|
||||
@@ -1866,11 +1924,12 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
}
|
||||
else
|
||||
{
|
||||
// list all: omit variant voices and mbrola voices
|
||||
// list all: omit variant voices and mbrola voices and test voices
|
||||
j = 0;
|
||||
for(ix=0; (v = voices_list[ix]) != NULL; ix++)
|
||||
{
|
||||
if((v->languages[0] != 0) && (strcmp(&v->languages[1],"variant") != 0) && (memcmp(v->identifier,"mb/",3) != 0))
|
||||
if((v->languages[0] != 0) && (strcmp(&v->languages[1],"variant") != 0)
|
||||
&& (memcmp(v->identifier,"mb/",3) != 0) && (memcmp(v->identifier,"test/",5) != 0))
|
||||
{
|
||||
voices[j++] = v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user