pyttsx3 save to file 1

pyttsx3 save to file

import pyttsx3
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")[0] 
engine.setProperty('voice', voices)
text = 'Your Text'
engine.save_to_file(text, 'name.mp3')
engine.runAndWait() # don't forget to use this line

Here is what the above code is Doing:
1. Initialize the engine
2. Get the voices
3. Set the voice
4. Save the voice to a file
5. Run the engine

Similar Posts