DeepHorizons / tts

A simple python TTS wrapper
51 stars 19 forks source link

sapitts doesn't close the stream after creating the file #6

Closed kurdishdevil closed 4 years ago

kurdishdevil commented 4 years ago

sapitts doesn't close the stream after creating the file, so the code only works twice unless you have to restart the whole program,

here's my post on stackoverflow that shows how to fix it

https://stackoverflow.com/questions/59698230/sapitts-creates-the-file-but-keeps-it-running

DeepHorizons commented 4 years ago

Thanks for the issue. Unfortunately the stack overflow question was deleted and the way back machine doesn't have a copy of the answer. Looking into it it seems I missed closing the stream, can you confirm that this code will fix the problem?

...
        stream = self._create_stream(filename)
        temp_stream = self.voice.AudioOutputStream
        self.voice.AudioOutputStream = stream
        self.say(message)
        self.voice.AudioOutputStream = temp_stream
        stream.Close()