From aacd63116ddfe09439f6ee26068e6510a787898f Mon Sep 17 00:00:00 2001 From: Poogee Date: Thu, 9 Feb 2023 22:25:21 +0300 Subject: [PATCH] fix: tts blending sentences from diff. paragraphs --- TTS/engine_wrapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TTS/engine_wrapper.py b/TTS/engine_wrapper.py index 6ca63d5..d25b622 100644 --- a/TTS/engine_wrapper.py +++ b/TTS/engine_wrapper.py @@ -51,11 +51,18 @@ class TTSEngine: self.length = 0 self.last_clip_length = last_clip_length + def add_periods(self): # adds periods to the end of paragraphs (where people often forget to put them) so tts doesn't blend sentences + for comment in self.reddit_object["comments"]: + comment["comment_body"] = comment["comment_body"].replace('\n', '. ') + if comment["comment_body"][-1] != '.': + comment["comment_body"] += '.' + def run(self) -> Tuple[int, int]: Path(self.path).mkdir(parents=True, exist_ok=True) print_step("Saving Text to MP3 files...") - + + self.add_periods() self.call_tts("title", process_text(self.reddit_object["thread_title"])) # processed_text = ##self.reddit_object["thread_post"] != "" idx = None