Microsoft C#中字符串的Microsoft认知服务语音识别结果

时间:2020-02-11 09:29:00

标签: c#

我将在C#Window表单应用程序中显示识别语音结果。但是,在将结果转换为字符串并将其显示在文本框中时遇到了问题。

在这里附上我的代码: 在我的Voice.cs中

namespace GUI_FYP
{
class Voice
{
    public static async Task<RecognitionResult> RecognizeSpeechAsync()
    {
        var config = SpeechConfig.FromSubscription("xxxxxxxxxxxxxxxx", "southeastasia");

        using (var recognizer = new SpeechRecognizer(config))
        {
            var result = await recognizer.RecognizeOnceAsync();
            return result;

        }
    }

}
}

在我的Form.cs

private void VoiceStart_Click_1(object sender, EventArgs e)
    {
        Voice.RecognizeSpeechAsync().Wait();
        string command = Voice.RecognizeSpeechAsync().Result.ToString;
        VoiceBox.Text = command;

    }

但是我的错误显示了这一点:

0 个答案:

没有答案