[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.

<code>
import pyTTS

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

</code>

TJG

[1] http://www.cs.unc.edu/Research/assist/doc/pytts/
[2]
http://sourceforge.net/project/showfiles.php?group_id=65529&package_id=74248



More information about the python-win32 mailing list