Skip to content

Commit bb2ab22

Browse files
committed
Workaround for Google TTS not pausing for dashes
1 parent 3941449 commit bb2ab22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/talkinghead.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ class TalkingHead {
20262026
// Classifiers
20272027
const dividersSentence = /[!\.\?\n\p{Extended_Pictographic}]/ug;
20282028
const dividersWord = /[ ]/ug;
2029-
const speakables = /[\p{L}\p{N},\.'!\$\+\-%&\?]/ug;
2029+
const speakables = /[\p{L}\p{N},\.'!\$\+\p{Dash_Punctuation}%&\?]/ug;
20302030
const emojis = /[\p{Extended_Pictographic}]/ug;
20312031
const lipsyncLang = opt.lipsyncLang || this.avatar.lipsyncLang || this.opt.lipsyncLang;
20322032

@@ -2474,7 +2474,8 @@ class TalkingHead {
24742474
.replaceAll('<','&lt;')
24752475
.replaceAll('>','&gt;')
24762476
.replaceAll('"','&quot;')
2477-
.replaceAll('\'','&apos;');
2477+
.replaceAll('\'','&apos;')
2478+
.replace(/^\p{Dash_Punctuation}$/ug,'<break time="750ms"/>');
24782479

24792480
});
24802481
ssml += "</speak>";

0 commit comments

Comments
 (0)