Speak what I type

This script uses the Microsoft Speech SDK to speak what you type in
from the keyboard. To stop the script use STRG+Z. MS Speech Engine has
to be installed and makepy should be executed for the MS Speech Object
Library.

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 to exit."
while 1:
   try:
      s = raw_input()
      speaker.Speak(s)
   except:
      if sys.exc_type is EOFError:
         sys.exit()

Leave a Reply

Your email address will not be published. Required fields are marked *