From bce52025261161fe46636923e099f77b34e92ace Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 6 Jun 2022 17:46:55 +0100 Subject: [PATCH] Add function to call TTS - reduces code reuse --- tts/engine_wrapper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tts/engine_wrapper.py b/tts/engine_wrapper.py index b0f09e2..6b42e5b 100644 --- a/tts/engine_wrapper.py +++ b/tts/engine_wrapper.py @@ -21,3 +21,7 @@ class TTSEngine: self.path = path self.max_length = max_length self.length = 0 + + def call_tts(self, filename, text): + self.tts_function(text=text, filepath=f"{self.path}/{filename}.mp3") + self.length += MP3(f"{self.path}/{filename}.mp3").info.length