小编Bil*_*Bai的帖子

如何让 Microsoft Azure Speech To Text 在程序运行时开始转录?(统一,C#)

我正在尝试使用 Unity3D 中的 Microsoft Azure 认知服务语音转文本 SDK 构建一个简单的应用程序。我已经按照这个教程学习了,效果很好。本教程的唯一问题是语音转文本是通过按钮激活的。当您按下按钮时,它将在整个句子期间进行转录,并且您必须再次按下该按钮才能再次转录。我的问题是,我希望程序在 Unity 中运行后立即开始转录,而不是每次我想转录句子时都必须按一个按钮。

这是代码。

    public async void ButtonClick()
    {
        // Creates an instance of a speech config with specified subscription key and service region.
        // Replace with your own subscription key and service region (e.g., "westus").
        var config = SpeechConfig.FromSubscription("[My API Key]", "westus");

        // Make sure to dispose the recognizer after use!
        using (var recognizer = new SpeechRecognizer(config))
        {
            lock (threadLocker)
            {
                waitingForReco = true;
            }

            // Starts speech recognition, and …
Run Code Online (Sandbox Code Playgroud)

speech-recognition azure unity-game-engine azure-language-understanding azure-cognitive-services

2
推荐指数
1
解决办法
1992
查看次数