Browse Source

Fix changing mbrola voices in ssml (#1997)

This fixes #1011 by integrating mbrola voices details in ssml processing
master
Alexander Epaneshnikov 5 months ago
parent
commit
84a73939f2
No account linked to committer's email address

+ 2
- 0
src/libespeak-ng/readclause.c View File

@@ -609,6 +609,8 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_
xml_buf[n_xml_buf] = 0;
c2 = ' ';

if (base_voice.identifier)
strcpy(current_voice_id, base_voice.identifier);
terminator = ProcessSsmlTag(xml_buf, buf, &ix, n_buf, xmlbase, &audio_text, current_voice_id, &base_voice, base_voice_variant_name, &ignore_text, &clear_skipping_text, &sayas_mode, &sayas_start, ssml_stack, &n_ssml_stack, &n_param_stack, (int *)speech_parameters);

if (terminator != 0) {

+ 9
- 1
src/libespeak-ng/ssml.c View File

@@ -218,6 +218,7 @@ static const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espe
int voice_found;
espeak_VOICE voice_select;
static char voice_name[40];
static char identifier[40];
char language[40];

MAKE_MEM_UNDEFINED(&voice_name, sizeof(voice_name));
@@ -230,12 +231,14 @@ static const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espe
voice_select.identifier = NULL;

for (ix = 0; ix < n_ssml_stack; ix++) {
espeak_VOICE *v;
sp = &ssml_stack[ix];
int voice_name_specified = 0;

if ((sp->voice_name[0] != 0) && (SelectVoiceByName(NULL, sp->voice_name) != NULL)) {
if ((sp->voice_name[0] != 0) && ((v = SelectVoiceByName(NULL, sp->voice_name)) != NULL)) {
voice_name_specified = 1;
strcpy(voice_name, sp->voice_name);
strcpy(identifier, v->identifier);
language[0] = 0;
voice_select.gender = ENGENDER_UNKNOWN;
voice_select.age = 0;
@@ -256,7 +259,10 @@ static const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espe
}

if (voice_name_specified == 0)
{
voice_name[0] = 0; // forget a previous voice name if a language is specified
identifier[0] = 0;
}
}
if (sp->voice_gender != ENGENDER_UNKNOWN)
voice_select.gender = sp->voice_gender;
@@ -268,7 +274,9 @@ static const char *VoiceFromStack(SSML_STACK *ssml_stack, int n_ssml_stack, espe
}

voice_select.name = voice_name;
voice_select.identifier = identifier;
voice_select.languages = language;

v_id = SelectVoice(&voice_select, &voice_found);
if (v_id == NULL)
return "default";

+ 2
- 1
src/libespeak-ng/voices.c View File

@@ -1110,7 +1110,8 @@ char const *SelectVoice(espeak_VOICE *voice_select, int *found)
}

// select and sort voices for the required language
nv = SetVoiceScores(&voice_select2, voices, 0);
nv = SetVoiceScores(&voice_select2, voices,
voice_select2.identifier && strncmp(voice_select2.identifier, "mb/", 3) == 0 ? 1 : 0);

if (nv == 0) {
// no matching voice, choose the default

+ 0
- 1
tests/ssml/external-entity.expected View File

@@ -1,5 +1,4 @@


hˈɪɹ ɑː͡ɹ ðə pˈæswɜːdz



+ 0
- 1
tests/ssml/spec-example-1.expected View File

@@ -1,6 +1,5 @@



juː hæv fˈɔː͡ɹ nˈuː mˈɛsɪd͡ʒᵻz

ðə fˈɜːst ɪz fɹʌm stˈɛfəni wˈɪljəmz ænd ɚɹˈa͡ɪvd æt

Loading…
Cancel
Save