ssml: support break time multiplier

This commit is contained in:
Yury Popov
2023-02-26 18:19:09 +03:00
parent 31461c0e44
commit 8e163d5072
6 changed files with 20 additions and 3 deletions
+9
View File
@@ -77,6 +77,8 @@ static const char *help_text =
"\t Write speech to this WAV file, rather than speaking it directly\n"
"-b\t Input text encoding, 1=UTF8, 2=8 bit, 4=16 bit \n"
"-m\t Interpret SSML markup, and ignore other < > tags\n"
"--ssml-break=<percentage>\n"
"\t Set SSML break time multiplier, default is 100\n"
"-q\t Quiet, don't produce any speech (may be useful with -x)\n"
"-x\t Write phoneme mnemonics to stdout\n"
"-X\t Write phonemes mnemonics and translation trace to stdout\n"
@@ -331,6 +333,7 @@ int main(int argc, char **argv)
{ "compile-intonations", no_argument, 0, 0x10f },
{ "compile-phonemes", optional_argument, 0, 0x110 },
{ "load", no_argument, 0, 0x111 },
{ "ssml-break", required_argument, 0, 0x112 },
{ 0, 0, 0, 0 }
};
@@ -361,6 +364,7 @@ int main(int argc, char **argv)
int phoneme_options = 0;
int option_linelength = 0;
int option_waveout = 0;
int ssml_break = -1;
bool deterministic = 0;
espeak_VOICE voice_select;
@@ -586,6 +590,9 @@ int main(int argc, char **argv)
case 0x111: // --load
flag_load = 1;
break;
case 0x112: // --ssml-break
ssml_break = atoi(optarg2);
break;
default:
exit(0);
}
@@ -677,6 +684,8 @@ int main(int argc, char **argv)
espeak_SetParameter(espeakWORDGAP, wordgap, 0);
if (option_linelength > 0)
espeak_SetParameter(espeakLINELENGTH, option_linelength, 0);
if (ssml_break > 0)
espeak_SetParameter(espeakSSML_BREAK_MUL, ssml_break, 0);
if (option_punctuation == 2)
espeak_SetPunctuationList(option_punctlist);
+1 -1
View File
@@ -416,8 +416,8 @@ typedef enum {
espeakWORDGAP=7,
espeakOPTIONS=8, // reserved for misc. options. not yet used
espeakINTONATION=9,
espeakSSML_BREAK_MUL=10,
espeakRESERVED1=10,
espeakRESERVED2=11,
espeakEMPHASIS, /* internal use */
espeakLINELENGTH, /* internal use */
+2
View File
@@ -336,6 +336,8 @@ espeak_ng_STATUS SetParameter(int parameter, int value, int relative)
translator->langopts.intonation_group = new_value & 0xff;
option_tone_flags = new_value;
break;
case espeakSSML_BREAK_MUL:
break;
default:
return EINVAL;
}
+1 -1
View File
@@ -349,7 +349,7 @@ const int param_defaults[N_SPEECH_PARAM] = {
0, // wordgap
0, // options
0, // intonation
0,
100, // ssml break mul
0,
0, // emphasis
0, // line length
+2
View File
@@ -882,6 +882,8 @@ int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, con
if ((attr2 = GetSsmlAttribute(px, "time")) != NULL) {
value2 = attrnumber(attr2, 0, 1); // pause in mS
value2 = value2 * speech_parameters[espeakSSML_BREAK_MUL] / 100;
int wpm = speech_parameters[espeakRATE];
espeak_SetParameter(espeakRATE, wpm, 0);