2011/12/05

Programming your own Speech Recognition

Speech Recognition
I have a task to develop our own dictionary in windows Speech Recognition (in Windows7), which recogize only our words without having/using the normal (conversation) words that are used in Windows' Dictionary.
and when i was developing that, i did added my own words (as this helpful example), but still the program accepts all kind of words, and i don't want that.
While (hard) searching throught the net, it appeared that this is not possible to have my own dictionary as one said the following:

The shared recogniser which turns on the Windows command recognition grammar. and You can't avoid it, this is disappointing and frustrating. The solution is the second option, creating your own recogniser.
You do not need to turn on the Windows Speech recognition, instead you end up with your own recognition engine, completely independant of the Windows command recogniser.
This MSDN guide is for using WAV -> SR, but most of it applies:
http://msdn.microsoft.com/en-us/library/ms717071%28VS.85%29.aspx
Replace the Stream object wit han spAudio object and you're almost there, here's the Audio Object Code(shortened, no HRESULT checks):
CComPtr pAudioToken;
CComPtr pAudio;

// Try the default
hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &pAudioToken);


// Connect the Device
hr = pRecognizerEngine->SetInput(pAudioToken, TRUE);

hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &pAudio);
hr = pRecognizerEngine->SetInput(pAudio, TRUE);

After that you can continue using the MSDN link above, and will be almost finished, except you need to manually activate the Audio Stram from a microphone / Line-In:
hr = pGrammar->SetGrammarState(SPGS_ENABLED);
hr = pNavGrammar->SetDictationState(SPRS_ACTIVE);
Assuming you are careful in checking the errors, you'll have your own voice recognition, and NO windows commands going off!

Links:
  1. Windows Speech Recognition: How to Benefin from its Advanced Configuration Options
  2. Grammar Format Tags - to create your own grammar (dictionary) as this solitaire example
  3. How to disable windows 7 speech recognition COMMANDS

ليست هناك تعليقات: