Skip to content

I can save the output of pyttsx to a wav file in windows, but the process suspended #15

@hick

Description

@hick

sorry for I just have a little knowledge about both Python and win32 API.

but I had tried the old PYTTS package and some other code from google, and finnaly can save the wav file, by editing the pyttsx/drivers/sapi5.py as the following:

insert a line self._stream = win32com.client.Dispatch('SAPI.SpFileStream') after self._tts = win32com.client.Dispatch('SAPI.SPVoice') to create a file stream .

and in the function say , add some code around self._tts.Speak(unicode(text), 19) :

self._stream.Open("test.wav", 3) 
self._tts.AudioOutputStream = self._stream
self._tts.Speak(unicode(text), 19)

it worked, but, my python script never stopped, just suspended, I had try to edit the say function and runAndWait function, failed with my poor knowledge,

maybe somebody can help me?
or maybe some other way to record the tts 's output to wav or mp3 files---I tried to record by pyaudio, but it always recorded the microphone directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions