Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyttsx3 as pt
- from gtts import gTTS
- from tqdm import tqdm as bar
- from time import sleep
- path = input("Введите путь к файлу: ")
- def convert(path):
- engine = pt.init()
- with open(path, "r") as file:
- txt = file.read()
- engine.say(txt)
- engine.runAndWait()
- for i in bar(range(100)):
- sleep(0.01)
- tts = gTTS(text = txt, lang = "ru")
- tts.save("filename.mp3")
- print("File saved!")
- conver(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement