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

xml_buf[n_xml_buf] = 0; xml_buf[n_xml_buf] = 0;
c2 = ' '; 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); 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) { if (terminator != 0) {

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

int voice_found; int voice_found;
espeak_VOICE voice_select; espeak_VOICE voice_select;
static char voice_name[40]; static char voice_name[40];
static char identifier[40];
char language[40]; char language[40];


MAKE_MEM_UNDEFINED(&voice_name, sizeof(voice_name)); MAKE_MEM_UNDEFINED(&voice_name, sizeof(voice_name));
voice_select.identifier = NULL; voice_select.identifier = NULL;


for (ix = 0; ix < n_ssml_stack; ix++) { for (ix = 0; ix < n_ssml_stack; ix++) {
espeak_VOICE *v;
sp = &ssml_stack[ix]; sp = &ssml_stack[ix];
int voice_name_specified = 0; 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; voice_name_specified = 1;
strcpy(voice_name, sp->voice_name); strcpy(voice_name, sp->voice_name);
strcpy(identifier, v->identifier);
language[0] = 0; language[0] = 0;
voice_select.gender = ENGENDER_UNKNOWN; voice_select.gender = ENGENDER_UNKNOWN;
voice_select.age = 0; voice_select.age = 0;
} }


if (voice_name_specified == 0) if (voice_name_specified == 0)
{
voice_name[0] = 0; // forget a previous voice name if a language is specified voice_name[0] = 0; // forget a previous voice name if a language is specified
identifier[0] = 0;
}
} }
if (sp->voice_gender != ENGENDER_UNKNOWN) if (sp->voice_gender != ENGENDER_UNKNOWN)
voice_select.gender = sp->voice_gender; voice_select.gender = sp->voice_gender;
} }


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

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

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

} }


// select and sort voices for the required language // 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) { if (nv == 0) {
// no matching voice, choose the default // no matching voice, choose the default

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




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





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






juː hæv fˈɔː͡ɹ nˈuː mˈɛsɪd͡ʒᵻz 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 ðə fˈɜːst ɪz fɹʌm stˈɛfəni wˈɪljəmz ænd ɚɹˈa͡ɪvd æt

Loading…
Cancel
Save