ASPN ActiveState Programmer Network  
ActiveState, a division of Sophos
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups
Submit Recipe
My Recipes

All Recipes
All Cookbooks


View by Category

Title: Text-to-Speech
Submitter: Nelson Rush (other recipes)
Last Updated: 2002/02/13
Version no: 1.0
Category:

 

5 stars 2 vote(s)


Description:

An example of using the MS Speech SDK to implement TTS (Text-To-Speech).

Source: Text Source

# speak.py
#
# Repeats what user types.
#
# Make sure you have MS Speech SDK installed
# and registered with the MakePy tool in PythonWin.
#
import sys
from win32com.client import constants
import win32com.client

speaker = win32com.client.Dispatch("SAPI.SpVoice")
print "Type word or phrase, then enter."
print "Ctrl+Z then enter (dos/win32) or Ctrl+D (unix) to exit."
while 1:
	try:
		s = raw_input()
		speaker.Speak(s)
	except:
		if sys.exc_type is EOFError:
			sys.exit()

Discussion:

This is fun, you could make a Dr. Sbaitso clone if you throw some Markov chains in.



Add comment

No comments.



Highest rated recipes:

1. A simple XML-RPC server

2. Web service accessible ...

3. Wrapping template engine ...

4. Assignment in expression

5. SOLVING THE METACLASS ...

6. Povray for python

7. Calling Windows API ...

8. Generic filter logic ...

9. Function Decorators by ...

10. MS SQL Server log monitor




Privacy Policy | Email Opt-out | Feedback | Syndication
© 2006 ActiveState Software Inc. All rights reserved.