def stream(self): """Получаем поток""" tts = speaker(self.text, lang=self.lang) urls = tts.get_urls() url = urls[0] return url
def mp3_to_text(self, _file): """Считываем файл и получаем текст""" tts = speaker(self.text, lang=self.lang) with open(_file, 'wb') as f: tts.write_to_fp(f)
def to_play(self): """Проигрываем наш текст""" mp3_fp = BytesIO() tts = speaker(self.text, lang=self.lang) tts.write_to_fp(mp3_fp)
def streams(self): """Получаем потоки""" tts = speaker(self.text, lang=self.lang) urls = tts.get_urls() return urls
def to_mp3(self, _file = 'speak.mp3'): """Преводим текст в *.mp3""" tts = speaker(self.text, lang=self.lang) tts.save(_file) print(f"Создался файл {_file}")
def mp3_to_text(self, _file): tts = speaker(f'{self.text}', lang=f'{self.lang}') with open(f'{_file}', 'wb') as f: tts.write_to_fp(f)
def stream(self): tts = speaker(f'{self.text}', lang=f'{self.lang}') urls = tts.get_urls() url = urls[0]
def to_play(self): mp3_fp = BytesIO() tts = speaker(f'{self.text}', lang=f'{self.lang}') tts.write_to_fp(mp3_fp)
def to_mp3(self): tts = speaker(f'{self.text}', lang=f'{self.lang}') tts.save('speak.mp3')