How to disable windows 7 speech recognition COMMANDS


  • I'm developing an application that utilizes MSSR.  The program has its own unique grammar system, which works just fine.

    My problem is this...occasionally while using my application, MSSR misinterprets something said and identifies it as one of the many preprogrammed commands assocated with using the Windows 7 OS...things like 'start', 'file', 'open', etc.  This is not a desired outcome when a user is just trying to use my application, and some other window flies open! LOL

    How in the world do I disable the preprogrammed speech recognition commands in Windows 7?

    There is another thread associated with this topic with no resolution here:

    As a side story to all of this...I was on the phone for HOURS with MS tech support, moving through various ranks...and they basically said, "we cannot help you".  However, they did give me the general phone line to MS, which connects you to some very nice switchboard ladies.  However, the switchboard is only organized by individual, not department so you cannot get a hold of anyone in generallity.  Finally, by virtue of the 'interweb', I found a website for the MS research group, which has a special group for speech recognition.  I finally got ahold of someone in the SR research group, and this is what they told me, word for word..."you're going to have to figure this out on your own".  Seriously.  Then, when I asked if he had a number I could call to talk with someone about this problem, dude says..."NO"...then hangs up!  Wow huh?




    Thursday, May 06, 2010 9:40 PM

All replies

  • No one has anything on this yet?  I'm still dig'n around to try to figure out how to shut the commands luck.
    Monday, May 10, 2010 2:10 PM
  • Should I assume the lack of a response from anyone within MS means they simply overlooked a way to handle this situation?  Anyone? Anyone? Bueller? Bueller?
    Thursday, May 13, 2010 2:48 PM
  • Create a grammar with duplicate windows commands and increase your own grammar's priority.


    grammarList.Add("start menu");

    create grammar

    grammar.Priority = 127;

    Then Load your grammar to SpeechRec



    Tuesday, June 22, 2010 6:52 PM
  • Hi all,


    My team and I stumbled upon this article yesterday, along with another 1000x sites that can't solve the issue. So we found the solution ourselves.

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


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


        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);


    Good Luck!

    Saturday, July 31, 2010 3:23 AM
  • Heya Mike,


    Not sure if you'll still be interested, but there is a solution to your question. If you've moved on, it'll still be relevant to the rest of us, so I'll post away....


    There's two ways to instance a speech recogniser using SAPI. The most common, and the simplest is through simply using the shared recogniser:

    hr = pRecognizerEngine.CoCreateInstance( CLSID_SpSharedRecognizer );

    The more complicated way is to create your own recogniser:

    hr = pRecognizerEngine.CoCreateInstance( CLSID_SpInprocRecognizer );

    The shared recogniser requires that you enable the shared recogniser, which turns on the Windows command recognition grammar. 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:

    Replace the Stream object wit han spAudio object and you're almost there, here's the Audio Object Code(shortened, no HRESULT checks):

        CComPtr<ISpObjectToken> pAudioToken;
        CComPtr<ISpAudio> 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!


    Have funz0r!

    -Dr Black Adder

    Saturday, July 31, 2010 3:47 AM
  • Hi.

    I too ran into this problem today.  If you are using the .NET framework (System.Speech.Recognition), then I suspect that you are using the SpeechRecognizer class.  This class apparently uses the shared engine that Dr Black Adder mentions.

    The solution, as I found elsewhere after thorough searching, is to use the SpeechRecognitionEngine class instead (which allegedly uses the inproc engine)!  After reading that solution, I am certain it will work, as I recall using that very same class about two years ago and not having this problem.  It is a little more complicated to set up and use, but well worth it to get rid of the default windows commands.

    The original solution is posted at the bottom of this page in post #3 from Jan 15, 2007:

    Also here is what looks like a C# version of Dr Black Adder's solution: 



    Sunday, August 01, 2010 8:49 AM
  • Here is the C# code for my simple voice command library.  I warn that accurately filtering by confidence % is critical to success, as the SpeechRecognitionEngine will recognize the word "pause" as being "color red" and still give it 85% confidence.  Just ignore all recognitions with a confidence % less than 0.90, 0.93, or 0.95 or so.  Or, if you can live with windows default commands being included alongside your own, SpeechRecognizer seemed to be considerably more accurate.

    I hope this code helps someone!


    public class VoiceHandler
      #region SpeechEvent
      public delegate void SpeechEventHandler(object sender, string recognized);
      public event SpeechEventHandler SpeechEvent;
      private void RaiseSpeechEvent(string recognized)
       if (SpeechEvent != null)
        SpeechEvent(null, recognized);
      public float RequiredConfidence = 0.9f;
      public string[] commands = new string[] { "Color Default", "Screen 1", "Screen 2", "Screen 3", "Screen 4", "Screen 5", "Color Red", "Color Purple", "Color Blue", "Color Orange", "Color White"};
      public int FormNumber = 5;
      SpeechRecognitionEngine rec;
      public VoiceHandler()
       rec = new SpeechRecognitionEngine();
       Choices c = new Choices();
       for (int i = 0; i < commands.Length; i++)
       GrammarBuilder gb = new GrammarBuilder(c);
       Grammar g = new Grammar(gb);
      public void StartListening()
       rec.SpeechRecognized += rec_SpeechRecognized;
      public void StopListening()
       rec.SpeechRecognized -= rec_SpeechRecognized;  
      void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
       //System.Windows.Forms.MessageBox.Show(e.Result.Text + "\r\nConfidence: " + e.Result.Confidence);
       if (e.Result.Confidence >= RequiredConfidence)


    • Proposed as answer by BorgSmilie Thursday, October 21, 2010 1:07 AM
    Sunday, August 01, 2010 9:21 AM
  • Hi Dr Black Adder,

    I have same problem in c# and since I'm not familiar with c++ I don't understand the code you've written. Can you explain me what exactly I should do for Audio object or tell me where I can read more about it? I couldn't find anything related to it in c# in the web.




    Wednesday, September 01, 2010 8:12 PM
  • Thank you Brian,


    I admit, I skimmed over this code, and since didn't see the word inProc anywhere I dismissed it.


    This solution works well if you want to avoid using the Windows Shared Speech Recognizer.


    Thanks again!


    Thursday, October 21, 2010 1:09 AM