Microsoft Speech Recognition Platform
Ich habe eine App in C # für die Spracherkennung mit System.Speech geschrieben, die unter Windows 7 einwandfrei funktioniert. Ich habe jedoch dieselbe App erstellt, die unter Windows 2003 (x86) funktioniert.
Meine Programmierumgebung: Windows 7 x 64 Pro Visual Studio 2008
Um diese Anwendung in meiner Programmierumgebung zu entwickeln, installierte ich:
1. Microsoft Speech Platform - Server-Laufzeit (Version 10.1) (x86)
2. Microsoft-Sprachplattform - Software Development Kit (SDK) (Version 10.1) (x86)
3. Microsoft Speech Platform - Server-Laufzeitsprachen (Version 10.1)
(hier SR für en-GB installiert)
In meinem Programm habe ich anstelle von System.Speech Microsoft.Speech.Recognition verwendet.
Dieser Code stammt aus der SDK-Dokumentation:
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;
}
}
Ich habe in den Projekteigenschaften auch das Plattformziel auf x86 festgelegt. Code wird kompiliert, aber sobald ich ihn starte oder debugge, funktioniert er nicht mehr. Irgendeine Idee, was ich vermisse?