[python-win32] How Do You Make Your Speech or SAPI 5 Voices

FT chester_lab at fltg.net
Fri Jun 27 00:28:10 CEST 2008


From: Tony Cappellini 
Message: 1
Date: Thu, 26 Jun 2008 08:01:21 -0400
From: "FT" <chester_lab at fltg.net>
Subject: [python-win32] How Do You Make Your Speech or SAPI 5 Voices
       Portable?
To: <python-win32 at python.org>


This doesn't address your portability issue, but is provided as an FYI.
Peter Parente already has a nice Python wrapper from the Microsoft Speech API- PyTTS
http://sourceforge.net/project/showfiles.php?group_id=65529&package_id=74248

Hi Tony,

    Thanks, but I had used that first. My methods are simple, and essentially identical, but I added the pitch method, for he did not include it. Do not know why, did not ask him, but I am using the SAPI 5 and do a check to see if it is loaded onto the machine. Yet doing that check I do not do anything if the False comes back. 

    I have not added other methods to it, at least not in my test samples. 

    But, the question of most importance is how to have my py2exe also include the wrapper for installing a speech engine if none exist on the destination computer. Which would mean as tim had mentioned, have it pop up an install, which would mean have them go to a link, or have the install in the data folder or as is and run the install. But that means porting in up to 35 megs or more to run the SAPI 5. 
    But having said that from XP on in windows machines the SAPI 5 is installed, but is Vista compatible? For I have heard so many nightmarish stories about Vista, there is no guarantee.

    Anyway, in response to your suggestion, I have pyTTS on my machine, studied there methods, took a look at what the SAPI has and decided to write my own, learn it, and expand on it. To allow a simple speech method for anyone to use. It is not written in C and relies only on SAPI 5 engine methods, along with XML commands.

    In other words a simple speech to plug into anyones program/game.

    So, the engine part may not be an issue except for older machines, I am interested in porting voices only. The eSpeak install is a small install, as is the extra SAPI 5 voices, Mike and Mary are.

    I do no that the NVDA project exists, but when asking them how they do it I was told to learn it on my own.

    In the NVDA project it appears they install up to 4 voice engines, including eSpeak and SAPI, and was wondering how they did it.

    Anyway, I will just keep on asking until I stumble onto the way by accident. Which is what I did when searching for the stream file to use for the save and read of .wav files. It took over 30 searches to find it. I had to just get the search parms exact before finding the needed  format for the file stream in comtypes.

    Now that I found out how that is installed, now I may have found the one Microsoft variable that eluded me when looking at there sapi help. Which means I might be able to write all the commands inside the com types, but have not bothered to yet.

    The pyTTS does not allow you to use a simple name for voices, but eSpeak is as long as Microsoft. But I list the voices in my test sapi file. And when using them I search for the space in the name and default to -1 if not found, but in both cases add one to start at the proper position.

    Time to get moving on, this response is getting too long.

        Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080626/ed6c99df/attachment.htm>


More information about the python-win32 mailing list