Microsoft Speech Recognition Platform
Asked Answered
B

1

8

I wrote an app in C# for speech recognition using System.Speech which works fine on Windows 7. However I'm after creating the same app that will work on windows 2003 (x86).

My programming environment: Windows 7 x64 Pro Visual Studio 2008

In order to develop this application in my programming environment I installed:

1.Microsoft Speech Platform - Server Runtime (Version 10.1) (x86)

http://www.microsoft.com/downloads/details.aspx?FamilyID=674356C4-E742-4855-B3CC-FC4D5522C449&displaylang=en&displaylang=en

2.Microsoft Speech Platform - Software Development Kit (SDK) (Version 10.1) (x86)

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4d36908b-3264-49ef-b154-f23bf7f44ef4

3.Microsoft Speech Platform - Server Runtime Languages (Version 10.1)

(here installed SR for en-GB)

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=f704cd64-1dbf-47a7-ba49-27c5843a12d5

In my program instead of System.Speech I used Microsoft.Speech.Recognition;

Pasted this code from SDK documentation:

using Microsoft.Speech.Recognition;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
      // Create a new SpeechRecognitionEngine instance.
      sre = new SpeechRecognitionEngine();

      // Create a simple grammar that recognizes “red”, “green”, or “blue”.
      Choices colors = new Choices();
      colors.Add("red");
      colors.Add("green");
      colors.Add("blue");

      GrammarBuilder gb = new GrammarBuilder();
      gb.Append(colors);

      // Create the actual Grammar instance, and then load it into the speech recognizer.
      Grammar g = new Grammar(gb);
      sre.LoadGrammar(g);

      // Register a handler for the SpeechRecognized event.
      sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
      sre.SetInputToDefaultAudioDevice();
      sre.RecognizeAsync(RecognizeMode.Multiple);
    }

    // Simple handler for the SpeechRecognized event.
    void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
      MessageBox.Show(e.Result.Text);
    }

    SpeechRecognitionEngine sre;
  }
}

I also set platform target to x86 in project properties. Code compiles but once I run or debug it recognition doesn't work. Any idea what am I missing?

Bulkhead answered 30/8, 2010 at 12:42 Comment(3)
At least on Windows XP you cannot run speech recognition software without installing components from the SDK. Are you sure that the required components exists on the target computer?Partook
The idea is get this working on the local machine first and later deploy it to windows 2003. My programming machine is Windows 7 x64 VS2008 which has Runtime,SDK and enGB SR installed as detailed above. Compiles, runs on my machine but it doesn't recognize choices (color names)Bulkhead
When debugging I have noticed that in sre = new SpeechRecognitionEngine(); properties: EndSilenceTmeout EndSilenceTmeoutAmbiguous throw exception: "Recognizer setting not supported by recognizer but the program continues to execute.Bulkhead
C
6

You're creating a speech recognition engine without specifying an engine. Since you've installed the en-GB engine, you need to specify a cultureinfo (or a recognizerinfo):

sre = new SpeechRecognitionEngine(new CultureInfo("en-GB")); 
Catastrophe answered 31/8, 2010 at 18:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.