Sapi.SpVoice

Allgemeines zum Thema EventGhost
MonsterMagnet
Plugin Developer
Posts: 137
Joined: Fri Feb 10, 2006 12:04 pm

Post by MonsterMagnet » Wed Mar 29, 2006 11:31 am

Ja das wär schön, vielleicht fällt Dir auch noch etwas ein um die User Freundlichkeit zuverbessern.

peter
Posts: 19
Joined: Sat Jul 05, 2008 6:46 pm
Location: Belgium (NL)

Re: Sapi.SpVoice

Post by peter » Tue Dec 30, 2008 6:34 pm

Here attached is a new SpeechRecognition plugin.

I zipped the whole SpeechRecognition plugin as attachment.

It is based on the code in the thread above and with some extra modifications to make it work with current eventghost version (0.3.6.1487) and tested with Windows XP (Prof SP3) and to make them more userfriendly to use like the other components by adding plugins and configuring actions the usual way.
Feel free to modify further and improve if needed, but this works already and might want to be included in next release as new plugin.

PS 1: Speech SDK (f.e. v5.1) can be downloaded from MS here: http://www.microsoft.com/downloads/deta ... laylang=en

PS 2: I noticed one general error with the test function on the config panel of an action. If one has an existing action in the tree and configures the action (making modifications in config panel of action) and then press test button and then decides to still press cancel, it still is as if one pressed OK and the modified configuration used to test is taken over ( instead of return to orriginal config panel state before making changes, like one would usually expect from a cancel button)

PS 3: To use this Plugin: extract zip file and copy contents of zipfile into the Plugin Directory of EventGhost (normally under program files). Restart eventghost.
In Eventghost insert into the EG configuration tree the SpeechRecognition Plugin (not speech plugin).
Then add a macro with a SpeechRules action (available under SpeechRecognition folder in the new action dialog when SpeechRecognition plugin was added into tree)
Then Configure that new action to add the Words / EventNames you want it to recognise/generate (and test it or execute this action once to start recognition.)
Tip: Choose distinct Eventnames and easy to pronounce english single word eventnames to make it easy for the speechrecognition engine to recognise without mistakes.
NOTES ON CURRENT FUNCTIONALITY:
- Executing another SpeechRules action will end recognition of assigned words to any earlier executed SpeechRules action. (thus allowing to start listening for different keywords)
- Enabling or disabling the SpeechRecognition Plugin itself will Enable / Disable Speech recognition of any SpeechRules active at that time.
- Enabling or disabling the SpeechRules Action itself will actually not influence the processing of word recognition related to that Action. The SpeechRules Action needs to run once to start it's recognition and will actually keep recognising the assigned words till a different SpeechRules action is executed. (or till Plugin is disabled) ( ==> The enabling or disabling of these SpeechRules actions will ofcourse cause the SpeechRules action itself to execute or not, thus potentially allowing to redefine or not the words being recognised)
- Once the SpeechRecognition engine detects in your voice one of the eventnames/words configured in the last executed Speechrules action, it will trigger automatically that matching word as EventGhost event. (pay attention to lowercase/uppercase when adding words to recognise in the voice input as events in the SpeechRule action configuration, since it will generate the event/word exactly as typed in that Configuration Panel)

Note: if plugin doesn't work: Ensure the correct Speech SDK for your OS/platform is installed already, if you have other SDK version or other operating system then XP, the delivered generated voice.py file needs potential replace, and can be regenerated with PythonWin (f.e. run COM makepy utility on Microsoft Speech Object Library 5.1 and rename resulting file as voice.py and put in the SpeechRecognition Plugin folder) as described in earlier link somewhere in this thread. (The current attached voice.py is generated with Microsoft Speech Object Library 5.0)

PS 4: Use Control Panel -> Speech -> tab: Speech Recognition to configure engine and microphone level and also to train the engine with your voice to further improve recognition results.

PS 5: Reattached initial zip file again to add Translation Support and also cleaned up earlier wrong class hierarchy

PS 6: Added SampleSpeechRecognition.xml EventGhost configuration file with some speechrecognition added on top of the usual Example.xml file (for some commands only yet)

PS 7: UPDATED FILE AGAIN ON 2-1-2009:
1) to add support for a python script to get the current list of recognised words (through an extra Commands getter function, returning list of currently known commands which is now added on the action)
2) to remove functionality to set speechrecognition when pressing OK on the configuration dialog, instead the action must be executed once to become active instead of only configured.
3) updated demo file to show how to let the PC speak the currently known commands in return to asking for "help".


PS 8 : ATTACHED SPEECHRECOGNITION ZIP FILE IS OUTDATED AND DOES NOT WORK WITH LATEST EVENTGHOST VERSION, PLEASE SEE MY LATER POST FOR NEWEST WORKING VERSION
You do not have the required permissions to view the files attached to this post.
Last edited by peter on Fri Sep 18, 2009 7:04 pm, edited 1 time in total.

DranDane
Posts: 18
Joined: Mon Dec 08, 2008 2:23 pm

Re: Sapi.SpVoice

Post by DranDane » Fri Jan 30, 2009 1:37 am

Thank youfor this great plugin Peter. What do you think of the performances of you plugin compared to GlovePIE or Shoot 1.6.4 ?

atri7202
Posts: 14
Joined: Thu Mar 12, 2009 10:54 pm

Re: Sapi.SpVoice

Post by atri7202 » Fri Jun 26, 2009 12:15 pm

Note: if plugin doesn't work: Ensure the correct Speech SDK for your OS/platform is installed already, if you have other SDK version or other operating system then XP, the delivered generated voice.py file needs potential replace, and can be regenerated with PythonWin (f.e. run COM makepy utility on Microsoft Speech Object Library 5.1 and rename resulting file as voice.py and put in the SpeechRecognition Plugin folder) as described in earlier link somewhere in this thread. (The current attached voice.py is generated with Microsoft Speech Object Library 5.0)



i have windows XP and have SAPI 5.1 --- so i do not need to regenerate the file if im running xp ?
how would i go about doing this where is the COM makeup utility, and do u mean rewrite the code or regenerate? {what version of PythonWin would you recommend for this to make it simple}
i am having problems getting it to work it will work for a minute or so then stop working all together, then about a few minutes later it will show a load of commands from speech recognition plugin.
please help i would appreciate it very much thank you in advance!!

specter333
Experienced User
Posts: 95
Joined: Thu Dec 27, 2007 12:26 am

Re: Sapi.SpVoice

Post by specter333 » Wed Jul 22, 2009 11:31 pm

I get this error message when I open EG. I downloaded the latest plugin, have the latest version of EG and have XP Pro SP3 with all available updates. Any ideas? Thanks

Code: Select all

Traceback (most recent call last) (1076):
  File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 288, in CreatePluginInstance
  File "C:\Program Files\EventGhost\plugins\SpeechRecognition\__init__.py", line 71, in __init__
  File "C:\Program Files\EventGhost\plugins\SpeechRecognition\voice.py", line 2470, in CreateRecoContext
  File "win32com\client\__init__.pyc", line 94, in Dispatch
AssertionError: this is deprecated and will go away

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Sapi.SpVoice

Post by Bitmonster » Thu Jul 23, 2009 7:40 am

Open __init__.py and search the line:

Code: Select all

import voice
and delete it. Then delete the file voice.py and try it again.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

specter333
Experienced User
Posts: 95
Joined: Thu Dec 27, 2007 12:26 am

Re: Sapi.SpVoice

Post by specter333 » Mon Jul 27, 2009 1:36 am

Now I get this error,

Code: Select all

Error while loading plugin-file SpeechRecognition.
Traceback (most recent call last) (1076):
  File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 126, in ImportPlugin
  File "C:\Program Files\EventGhost\plugins\SpeechRecognition\__init__.py", line 171, in <module>
TypeError: Error when calling the metaclass bases
    cannot create 'NoneType' instances
C:\Program Files\EventGhost\eg\Classes\PluginInfo.py:293: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

And it also gets,

Code: Select all

Plugin: SpeechRecognition #on
      Error starting plugin: SpeechRecognition
      Plugin load error!
I'm using the version dowloaded from Peter's post earlier in this thread, PS 7: UPDATED FILE AGAIN ON 2-1-2009: Is this the correct one for use with EG3.7.r1076? Also using XP Pro SP3 with all updates.

Thanks

Chaemelion
Posts: 9
Joined: Tue Jul 28, 2009 4:53 am

Re: Sapi.SpVoice

Post by Chaemelion » Thu Jul 30, 2009 1:40 pm

I don't know if anyone mentioned (I didnt bother to translate the last two pages) but someone mentioned looking for a german voice? A German voice (and many other good ones) can be found on the Cepstral website. The demo voices work, but inject registration notices into the text spoken. You can buy the voices for like $30 I believe someone said it was, or you could use the key generator >_>

peter
Posts: 19
Joined: Sat Jul 05, 2008 6:46 pm
Location: Belgium (NL)

Re: Sapi.SpVoice

Post by peter » Sun Sep 13, 2009 11:12 am

Installing the Microsoft Speech SDK
The Microsoft Speech SDK is a free download from http://microsoft.com/speech/.

After installing it, use the MakePy utility to produce a Python stub for the COM object (in PythonWin, select Tools | COM MakePy utility | Microsoft Speech Object Library 5.1).
(I installed, used and tested with Microsoft Speech Object Library 5.0 )

Rename resulting file as voice.py and put in the SpeechRecognition Plugin folder

PS: Python and Pythonwin can be gotten here :
http://www.python.org/download/windows/
http://sourceforge.net/projects/pywin32/files/

(I used orriginally python version 2.5.2 and now 2.6.2)
Last edited by peter on Fri Sep 18, 2009 7:42 pm, edited 1 time in total.

peter
Posts: 19
Joined: Sat Jul 05, 2008 6:46 pm
Location: Belgium (NL)

Re: Sapi.SpVoice

Post by peter » Fri Sep 18, 2009 6:40 pm


Keywords: voice recognition, speech recognition, voice commands, speech commands, speech to event, voice to event, speech interpretation, voice interpretation


The earlier voice.py file was created with python 2.5.2 and does not work anymore if using eventghost version 0.3.7 r1194. To solve the compatibility issues with voice.py and this new eventghost version, I regenerated the voice.py with python 2.6.2 and this makes it work again. Please delete the voice.pyc and replace the voice.py file in the earlier package with attached version and it works again when using the latest eventghost build available for download (as of this postingdate).

Note: this voice.py file is still generated from the Microsoft Speech Object Library (5.0) for windows xp


Have attached in this post the latest FULL SpeechRecognition plugin version as a zip file.
You do not have the required permissions to view the files attached to this post.

jofan
Posts: 7
Joined: Tue Sep 28, 2010 12:58 pm

Re: Sapi.SpVoice

Post by jofan » Mon Oct 18, 2010 7:10 am

Hi,
First of all thanks for the Speech Recognition pulgin, just starting to use this myself.

From my experience so far, the recognition works well but it would be great if i could disable the Windows default commands and just use those created within EventGhost?

I have tried to search web regarding this, but the solution sounds way to involved for me to do anything with.

This is what i have found so far....


You need to use an InProc version of speech recognition, which gives you a private recognizer.

Bad:

hr = pRecognizerEngine.CoCreateInstance( CLSID_SpSharedRecognizer ); // Shared, gives Windows the chance to recognise commands.

Good:

hr = pRecognizerEngine.CoCreateInstance( CLSID_SpInprocRecognizer ); // Private, does NOT allow Windows to process commands.

You'll have to do a lot more calls to set up the Audio Input, and manually activte the recognizer, but it will allow you to use your grammar without having to put up with Windows trying to 'help' you.

Two important lines you'll need to use before anything will happen:


hr = pNavGrammar->SetGrammarState(SPGS_ENABLED);
hr = pNavGrammar->SetDictationState(SPRS_ACTIVE);


Is this at all possible with EventGhost Speech recognition plugin, or is there any easier way to disable the windows recognition commands?

Regards, J

Post Reply