Better sentence separation for TTS

This commit is contained in:
SillyLossy
2023-05-14 00:50:49 +03:00
parent cace7fa96d
commit 06a745ebf8
4 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ class ElevenLabsTtsProvider {
settings settings
voices = [] voices = []
separator = ' ... ... ... '
get settings() { get settings() {
return this.settings return this.settings

View File

@ -247,7 +247,8 @@ async function processTtsQueue() {
const special_quotes = /[“”]/g; // Extend this regex to include other special quotes const special_quotes = /[“”]/g; // Extend this regex to include other special quotes
text = text.replace(special_quotes, '"'); text = text.replace(special_quotes, '"');
const matches = text.match(/".*?"/g); // Matches text inside double quotes, non-greedily const matches = text.match(/".*?"/g); // Matches text inside double quotes, non-greedily
text = matches ? matches.join(' ... ... ... ') : text; const partJoiner = (ttsProvider?.separator || ' ... ');
text = matches ? matches.join(partJoiner) : text;
} }
console.log(`TTS: ${text}`) console.log(`TTS: ${text}`)
const char = currentTtsJob.name const char = currentTtsJob.name

View File

@ -9,6 +9,7 @@ class SileroTtsProvider {
settings settings
voices = [] voices = []
separator = ' ... '
defaultSettings = { defaultSettings = {
provider_endpoint: "http://localhost:8001/tts", provider_endpoint: "http://localhost:8001/tts",

View File

@ -21,6 +21,7 @@ class SystemTtsProvider {
fallbackPreview = 'Neque porro quisquam est qui dolorem ipsum quia dolor sit amet' fallbackPreview = 'Neque porro quisquam est qui dolorem ipsum quia dolor sit amet'
settings settings
voices = [] voices = []
separator = ' ... '
defaultSettings = { defaultSettings = {
voiceMap: {}, voiceMap: {},