pyttsx3 icon indicating copy to clipboard operation
pyttsx3 copied to clipboard

Overwriting a given output file

Open brahmakulkarni opened this issue 4 years ago • 3 comments

Could someone tell me if it is possible to overwrite a given output file? ` import pyttsx3 as audio

player = audio.init() player.save_to_file("Hello", "test.mp3") player.save_to_file("How are you?", "test.mp3") player.runAndWait() ` In the example shown above, even though I am using save_to_file twice, the test.mp3 only plays "Hello" (i.e., the first statement is reflecting but the second isn't...

brahmakulkarni avatar Dec 25 '20 18:12 brahmakulkarni

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Dec 25 '20 18:12 issue-label-bot[bot]

@brahmakulkarni This is an issue inside of pyttsx3, for some reason in most cases runAndWait will only run the first statement. I use the following function to help with this issue in my code. (Keep in mind, you will have to modify this for your use case)

def speak(text=None):
    import pyttsx3

    # Initialize the engine
    engine = pyttsx3.init(driverName=None, debug=True)

    # Speak
    engine.say(text)

    engine.runAndWait()

TotallyAProgrammer avatar Dec 28 '20 06:12 TotallyAProgrammer