MCPcopy
hub / github.com/elebumm/RedditVideoMakerBot / call_tts

Method call_tts

TTS/engine_wrapper.py:145–168  ·  view source on GitHub ↗
(self, filename: str, text: str)

Source from the content-addressed store, hash-verified

143 print("OSError")
144
145 def call_tts(self, filename: str, text: str):
146 if settings.config["settings"]["tts"]["voice_choice"] == "googletranslate":
147 # GTTS does not have the argument 'random_voice'
148 self.tts_module.run(
149 text,
150 filepath=f"{self.path}/{filename}.mp3",
151 )
152 else:
153 self.tts_module.run(
154 text,
155 filepath=f"{self.path}/{filename}.mp3",
156 random_voice=settings.config["settings"]["tts"]["random_voice"],
157 )
158 # try:
159 # self.length += MP3(f"{self.path}/{filename}.mp3").info.length
160 # except (MutagenError, HeaderNotFoundError):
161 # self.length += sox.file_info.duration(f"{self.path}/{filename}.mp3")
162 try:
163 clip = AudioFileClip(f"{self.path}/{filename}.mp3")
164 self.last_clip_length = clip.duration
165 self.length += clip.duration
166 clip.close()
167 except:
168 self.length = 0
169
170 def create_silence_mp3(self):
171 silence_duration = settings.config["settings"]["tts"]["silence_duration"]

Callers 2

runMethod · 0.95
split_postMethod · 0.95

Calls 1

runMethod · 0.45

Tested by

no test coverage detected