Browse Source

Fix non-SSML pauses with libsonic (#1526)

Following #1512 

Ref: espeak-ng/espeak-ng-ios-app#34

I unfortunately have broken in-speech pauses by fixing ones that should
be constant-time.
This reverts such change and adds a compensation to SSML code.
master
Juho Hiltunen 2 years ago
parent
commit
38384e4a67
No account linked to committer's email address
3 changed files with 12 additions and 7 deletions
  1. 10
    1
      src/libespeak-ng/ssml.c
  2. 0
    4
      src/libespeak-ng/wavegen.c
  3. 2
    2
      tests/ssml.test

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

if ((attr2 = GetSsmlAttribute(px, "time")) != NULL) { if ((attr2 = GetSsmlAttribute(px, "time")) != NULL) {
value2 = attrnumber(attr2, 0, 1); // pause in mS value2 = attrnumber(attr2, 0, 1); // pause in mS


espeak_SetParameter(espeakRATE, speech_parameters[espeakRATE], 0);
int wpm = speech_parameters[espeakRATE];
espeak_SetParameter(espeakRATE, wpm, 0);

#if HAVE_SONIC_H
if (wpm >= espeakRATE_MAXIMUM) {
// Compensate speedup with libsonic, see function SetSpeed()
double sonic = ((double)wpm)/espeakRATE_NORMAL;
value2 = value2 * sonic;
}
#endif


// compensate for speaking speed to keep constant pause length, see function PauseLength() // compensate for speaking speed to keep constant pause length, see function PauseLength()
// 'value' here is x 10mS // 'value' here is x 10mS

+ 0
- 4
src/libespeak-ng/wavegen.c View File

if (length == 0) if (length == 0)
return 0; return 0;


#if HAVE_SONIC_H
length = (int)(length * sonicSpeed);
#endif

if (resume == false) if (resume == false)
n_samples = length; n_samples = length;



+ 2
- 2
tests/ssml.test View File

test_ssml_audio "<prosody 100%><break 1000ms>" c7b3e92d90063761e9744b40b17bc9204fe7d25b "<speak><prosody rate=\"100%\">Break<break time=\"1000ms\"/>test</prosody></speak>" test_ssml_audio "<prosody 100%><break 1000ms>" c7b3e92d90063761e9744b40b17bc9204fe7d25b "<speak><prosody rate=\"100%\">Break<break time=\"1000ms\"/>test</prosody></speak>"
( test_ssml_audio "<prosody 200%><break 1000ms>" 64213dbaf593b139b0b21840ba938cf597f7ad35 "<speak><prosody rate=\"200%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \ ( test_ssml_audio "<prosody 200%><break 1000ms>" 64213dbaf593b139b0b21840ba938cf597f7ad35 "<speak><prosody rate=\"200%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \
( test_ssml_audio "<prosody 200%><break 1000ms>" ff0837020dadeb8c5a20784d31624b8f0221d9a4 "<speak><prosody rate=\"200%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || exit 1 ( test_ssml_audio "<prosody 200%><break 1000ms>" ff0837020dadeb8c5a20784d31624b8f0221d9a4 "<speak><prosody rate=\"200%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || exit 1
( test_ssml_audio "<prosody 260%><break 1000ms>" 4eac3d4c5c893824dfa7434d0e66116d8ff18676 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \
( test_ssml_audio "<prosody 260%><break 1000ms>" 28b4ca77bd987d8a8a722d87f5daea70c2f7133a "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \
( test_ssml_audio "<prosody 260%><break 1000ms>" 4b4e30a2cfff1889972f013e514e81c1108283a4 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \
( test_ssml_audio "<prosody 260%><break 1000ms>" 9849f0d27f5641db6da1a8aea82578e83656d323 "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || \
( test_ssml_audio "<prosody 260%><break 1000ms>" bb172a03c16e90ad537981467059c9e7d28d6aba "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || exit 1 ( test_ssml_audio "<prosody 260%><break 1000ms>" bb172a03c16e90ad537981467059c9e7d28d6aba "<speak><prosody rate=\"260%\">Break<break time=\"1000ms\"/>test</prosody></speak>" ) || exit 1

Loading…
Cancel
Save