From 803c58b44e850cc5328616b76ae93c84d317cd63 Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:15:52 +0000 Subject: [PATCH] Extra tweak to the text preprocessing Discards any text to be generated that is 0 or 1 characters in length after the sentence is split down (usually this is a * or a " and just produces a strange sound). --- script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.py b/script.py index 0408145..62ef2c9 100644 --- a/script.py +++ b/script.py @@ -499,8 +499,8 @@ def output_modifier(string, state): parts = re.split(r'"', decoded_text) audio_files_paragraph = [] for i, part in enumerate(parts): - # Skip empty parts - if not part: + # Skip parts that are too short + if len(part.strip()) <= 1: continue # Determine if it's a narrator or voice part within double quotes is_narrator_part = is_narrator if i % 2 == 0 else False