SAPI不实现语音字母选择。语音命令应用

时间:2018-04-18 22:10:26

标签: c# speech-recognition speech user32

在我的语音命令应用程序中,我正在从外部源加载文件,处理该数据并将它们加载到可执行命令列表中

当我运行应用程序时,我在控制台中收到消息

Main.exe Information: 0: SAPI does not implement phonetic alphabet selection.

我尝试了添加

等解决方案
gram.Culture = New System.Globalization.CultureInfo("en-GB")

我认为这已经过时或者对这种类型的WPF应用程序不起作用

任何提示?

代码:

{
            InitializeComponent();




        }
        SpeechSynthesizer synth = new SpeechSynthesizer();
        PromptBuilder builder = new PromptBuilder();
        SpeechRecognitionEngine recog = new SpeechRecognitionEngine();
        private System.Windows.Input.Key k;
        private int vkey;
        private Choices cmd;

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            b1.IsEnabled = false;
            Choices list = new Choices();
            cmd = Singleton.getInstance().getChoices();
            list.Add(new string[] { "hello", "test", "it works", "sup", "windows", "grenade" });
            Grammar gr = new Grammar(new GrammarBuilder(cmd));

            try
            {
                recog.RequestRecognizerUpdate();
                recog.LoadGrammar(gr);
                recog.SpeechRecognized += Recog_SpeechRecognized;
                recog.SetInputToDefaultAudioDevice();
                recog.RecognizeAsync(RecognizeMode.Multiple);
            }

            catch
            {
                return;
            }
        }

0 个答案:

没有答案