SAPI and Python

Sean Kennedy therealorang at comcast.net
Mon Oct 16 13:32:47 EDT 2006


Ok - I've done a lot of searching with google for info on 
what I'm about to ask, and haven't found enough to accomplish
what I'm after - so if anyone has the answers (or even
just ideas on how to proceed) I'd love the help.

I'm fairly new to Python, but not to OO programming.  I've
written a simple wx application that uses an SpSharedRecognizer
for voice recognition, and currently sendKeys to send control
applications.  The basic ideas came from Inigo Surguy's 
web page describing voice recognition in Python.

The problems:

1.  The application is specifically tailored to World of Warcraft, 
and it will not be useful to the folks who might otherwise use it
if I can't share the audio in with Teamspeak and/or Ventrillo.  I
currently have Push-to-Talk implemented by clearing the wordsrule
when it's not listening and setting it when it is.  That, as far
as I can tell, will not allow another app to grab the audio in 
device.

My first notion of an idea on how to accomplish this came from the
following code at http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/SAPI51sr/html/VB_ISpeechRecognizer_AudioInput.asp

It looks there like they are releasing the audio-in.  However, setting
the AudioInput property to None in Python results in an exceptions with
a type mismatch.

Question:  Do you think clearing the AudioInput property will actually
release the audio-in?  And, what is the correct way to do it in Python?

2.  sendKeys works - but it has the problem of causing McAfee to perk
up and raise a warning on the python interpreter.  I can tell it to allow
the script to run, but it only works until the next time I close and 
restart the application. 

Question:  Is sendEvent a better way to do this?  And is there a nice
web site with sample python code about it?

Thanks from a python newbie for any insights you folks have.




More information about the Python-list mailing list