Skip to content

Commit

Permalink
Workaround for Google TTS not pausing for dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
met4citizen committed Jul 8, 2024
1 parent 3941449 commit bb2ab22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/talkinghead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ class TalkingHead {
// Classifiers
const dividersSentence = /[!\.\?\n\p{Extended_Pictographic}]/ug;
const dividersWord = /[ ]/ug;
const speakables = /[\p{L}\p{N},\.'!€\$\+\-–—%&\?]/ug;
const speakables = /[\p{L}\p{N},\.'!€\$\+\p{Dash_Punctuation}%&\?]/ug;
const emojis = /[\p{Extended_Pictographic}]/ug;
const lipsyncLang = opt.lipsyncLang || this.avatar.lipsyncLang || this.opt.lipsyncLang;

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

});
ssml += "</speak>";
Expand Down

0 comments on commit bb2ab22

Please sign in to comment.