[python-win32] possible to save the output of TTS to a WAV file?

Tim Golden mail at timgolden.me.uk
Fri Mar 7 22:21:45 CET 2008

Alec Bennett wrote:
> 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")

You definitely want the pyTTS module [1][2] for this --
which wraps the SAPI stuff at C level.

import pyTTS

speaker = pyTTS.Create ()
speaker.SpeakToWave ("c:/temp/hello.wav", "hello")



[1] http://www.cs.unc.edu/Research/assist/doc/pytts/

More information about the python-win32 mailing list