Alec Bennett schrieb:
> I'm trying to save the output of some TTS to a sound file, is this possible?
>
> Here's how I'm doing the TTS, though am certainly open to other methods:
>
> import pythoncom, win32com
> import win32api, win32com.client
> pythoncom.CoInitialize ()
>
> s = win32com.client.Dispatch("SAPI.SpVoice")
> s.Speak("hi there")
>
> Thanks for any help.
In comtypes, this code does 'speak to a file':
engine = CreateObject("SAPI.SpVoice")
stream = CreateObject("SAPI.SpFileStream")
from comtypes.gen import SpeechLib
stream.Open(fname, SpeechLib.SSFMCreateForWrite)
engine.AudioOutputStream = stream
engine.speak("Hello, World", 0)
stream.Close()
Should be trivial to convert it to pywin32.
Thomas
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32