Essentially, the idea is to open a document ("document2read.txt") and read all the lines from it. Each line contains three full sentences. Then, each line is made into an audio clip, saved with a unique name (audio_0.mp3, audio_1.mp3, etc). Heres my code so far:
import pyttsx3
#Open DOC
comments_file=open("document2read.txt", "r")
lines=comments_file.readlines()
#start speech to text engine
engine = pyttsx3.init()
#Vars
start="audio_"
i=0
for line in lines:
name=start+str(i)+".mp3"
print(line)
engine.save_to_file(line, name)
i+=1
engine.runAndWait()
My problem is that when I run this code, the audio clip only saves the first sentence of the line! Any ideas on what to do? I'm stumped.